0

このレイアウトを作成したいのですが、div2 の幅はコンテンツの影響を受けません

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

これが私のコードです:

    <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>

それで、どのように?

4

1 に答える 1

1

css プロパティを追加する

max-width:100px
于 2012-11-15T20:28:04.633 に答える