www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] Prevent div wrapping without fixed width

Hybrid View

  1. #1
    Join Date
    Oct 2012
    Posts
    2

    resolved [RESOLVED] Prevent div wrapping without fixed width

    How can I prevent divs wrapping inside a div container which doesn't have a fixed width?

    I have a parent div container which width set to 100%.
    Inside it there are two child divs, both floated to the right.
    The first div has a fixed width, but the second is supposed to fill the remaining space of the parent div, without wrapping.

    Is that possible?

    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,458
    Hi there bumpy,

    and a warm welcome to these forums.

    Try it like this...
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <title></title>
    
    <link rel="stylesheet" type="text/css" href="/">
    
    <style type="text/css">
    #first-child {
        float:right;
        width:300px;
        background-color:#fcc;
     }
    #second-child {
        margin-right:300px;
        background-color:#ccf;
     }
    </style>
    
    </head>
    <body>
    
    <div id="container">
     <div id="first-child">first child</div>
     <div id="second-child">second child</div>
    </div>
    
    </body>
    </html>
    
    coothead

  3. #3
    Join Date
    Oct 2012
    Posts
    2
    Perfect!
    I haven't even considered not floating the second div...

    Thank you very much for the answer and the quick response!

  4. #4
    Join Date
    Jan 2004
    Location
    chertsey, a small town s.w. of london, england.
    Posts
    1,458
    No problem, you're very welcome.



    coothead

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles