user1337896
user1337896

Reputation: 1321

make the float div 's position do not affected by his content , without setting width

I want to make this layout, div2's width will not be affected by his content

-----------------------------------------
          |      |               |
   div1   |      |      div2     |      
          |      |               |       
-----------------------------------------

Here is my code:

    <html>
    <body>

    <div style="background:red;height:200px;">

        <div  style="background:black;width:100px;float:left;height:100px;">

        </div>


        <div  style="background:green;height:50px;float:left;margin:10px;">
        when here the content is too much, this div will start another line, 
which is not wanted, I want this div to be float always, also , I dont know the with.
        </div>

    </div>


    <body>
    </html>

so , how ?

Upvotes: 0

Views: 99

Answers (1)

NccWarp9
NccWarp9

Reputation: 494

add the css property

max-width:100px

Upvotes: 1

Related Questions