Make a container with position absolute adapt to its content in Chrome

3

I want the container to adapt to the content (textarea) in Firefox it looks good.

But in chrome the container becomes smaller than the textarea.

This is what I have tried:

.item{
  border: solid 1px;
	position: absolute;
}
.marco{
  border: solid 1px red;
}
<div id="terminal-1" class="item item-terminal item-selected" draggable="true" figure="terminal" style="left: 145px; top: 123px;">
  <div class="marco" style="margin: 10%;">
    <textarea class="texto" cols="10" rows="1" placeholder="texto" style="margin: 10px 15px;">Texto</textarea>
  </div>
</div>
    
asked by Néstor Osvaldo 28.05.2018 в 04:59
source

1 answer

0

What you can do is apply the same margin rules to the two containers and set them display:inline-flex

Here you can read about flexible containers: link

Your code would be like this:

.item{
  border: solid 1px;
  display: inline-flex;
  position: absolute;

}
.marco{
  border: solid 1px red;
  display: inline-flex
}
<div id="terminal-1" class="item item-terminal item-selected" draggable="true" figure="terminal" style="left: 145px; top: 123px;">
  <div class="marco" style="margin: 10px 15px;">
    <textarea class="texto" cols="10" rows="1" placeholder="texto" style="margin: 10px 15px;">Texto</textarea>
  </div>
</div>
    
answered by 28.05.2018 в 05:14