Thursday 15 January 2015

css - Floated element keeps full "original" width of inner narrower block element -


I probably have a simple question.

There is an initial element with the block element inside me.

Adding text inside the block element increases the block element horizontally, as well as the original float (as it is supposed to be).

If I add width to the internal block element, the text is wrapped and the block element becomes that width.

However, the still started element is still wide because the block element will be without width set on it, where I expect it to be removed in the set width of the block element.

Is there an invisible width in the text?

This is a very simple bela which shows what I am talking about.

Thumbs li {float: left; Border: Solid 1px black; }. Thumbs Diva {Width: 20%; Border: Solid 1px red; } & Lt; Ul square = "thumb" & gt; & Lt; Li & gt; & Lt; Img src = "http://placehold.it/250X250" /> & Lt; Div & gt; Some text some text some text some text some text some texts text some text & lt; / Div & gt; & Lt; / Li & gt; & Lt; / Ul & gt;

Why does the block element remain detailed as without the width rule?

You set the width: 20%;

What I'm looking for is strange to see that because and

  • gt; is flattening, you can still get 20% & lt; Li & gt; Does anyone browse in the shape of the size of the div? Finally, Deval takes 100% of his material, then its size becomes 20%.

    If ; Li & gt; In CSS,

    No comments:

    Post a Comment