meotimdihia
meotimdihia

Reputation: 4299

Question about CSS float:left

   <div style="width: 800px;border:1px solid black">
          <div style="width:100px;height:100px;float:left;border:1px solid black"></div>
          <div style="float:left">ssdfsdfsdfsdgfag25w6a4g8w5614w5sge16dgf45d4sdffffffffffffffffffffffffffffffffffffffffffffffffffffff5s4f64s6f456a46f456a456456456f456we4f54we5gf45456v4sd5646sadf54s56f465as4f564as56f</div>
          <div style="clear:both"></div>
    </div>

It end up like this: alt text how to fix it

Upvotes: 0

Views: 103

Answers (2)

Grumpy
Grumpy

Reputation: 2253

Set height to 100 to for main div

Upvotes: 0

iain
iain

Reputation: 1935

put a width on the 2nd child div. you will also need to put a space in that string as it cannot wrap it across lines.

 <div style="width: 800px;border:1px solid black">
          <div style="width:100px;height:100px;float:left;border:1px solid black"></div>
          <div style="float:left; width: 100px">ssdfsdfsdfsdgfag25w6a4g8w5614w5sge16dgf45d4sdffffffffffffffffffffffffffffffffffffffffffffffffffffff5s4f64s6f456a46f456a456456456f456we4f54we5gf45456v4sd5646sadf54s56f465as4f564as56f</div>
          <div style="clear:both"></div>
    </div>

Upvotes: 2

Related Questions