4
Because the Edge in <span>
only moves the element sideways, but vertically the edge is outside the container father?
Notice in this example below that when I use the edge on <span>
she does not stand out the left of div
, but at the top of div
the edge is out... The edge seems not to take up space vertically, just horizontally. Why does this happen?
OBS: I don’t want a way to solve this, I know for example putting display:inline-block
in the span
would solve. What I want to know is why the Edge only occupies horizontal space and not vertical, it pushes the next element to the side, but at the top it does not push, and still stands out from the container, pq?
.container {
width:200px;
height:100px;
border:1px solid black;
}
span {
border:10px solid red;
/* display:inline; */
}
<div class = "container">
<span>text</span><span>text</span>
</div>
<div class = "container">
<span>text</span><br>
<span>text</span><br>
</div>
I think the
display
influence, if usingdisplay: inline-block
, it renders different– Ricardo Pontual
@Ricardopunctual yes I noticed, even had already written in the question. I just do not know pq on the display default it pushes sideways and not vertically, that’s the question.
– hugocsl
The span is inline by default, so it obeys the vertical line rule as if it were a text. If you convert it in block, then it will no longer behave as if it were a text and will move vertically away tb.
– Sam