www.webdeveloper.com
Results 1 to 3 of 3

Thread: Putting divs inside divs

  1. #1
    Join Date
    May 2007
    Posts
    126

    Putting divs inside divs

    Hi there,

    I am having serious trouble today... I have done variations of this theme several times but I can't seem to figure out what the problem is. I need to get the two divs with the dashed borders to go inside the div with the green solid border... For the life of me I can't get it right, err - I hate these days...

    The code is below - I has to be something simple... If you can point out my error I would appreciate the help. OH! I am testing on firefox.

    Thanks!

    Code:
    <html>
     <head>
      <title>Testing stuff</title>
     </head>
    
    <body>
     <div style="border: solid 2px green; width: 700px; height; 100px">
      <div style="height: auto; width: 400px; float: left; border: dashed 1px red; display: inline;">
       XXX
      </div>
      <div style="height: auto; width: 200px; border: dashed 1px gray; float: left; display: inline;">
       XXX
      </div>
     </div>
    </body>
    </html>

  2. #2
    Join Date
    Dec 2005
    Posts
    2,984
    Explained in full at the url below:
    http://nunos.zi-yu.com/?p=76

  3. #3
    Join Date
    May 2007
    Posts
    126
    Wow - thanks... I figured it out but that is a cool link.

    This is what the final code ended up like for any other traveler who might stumble upon this and have the same question...

    Code:
     <div style="height: 70px; width: 700px;">
      <div style="height: 65px; width: 500px; float: left">
       <asp:Label ID="PageDescriptionLabel" runat="server" Text="Label" CssClass="focusSearchResultsText" />
      </div>
      <div style="height: 65px; width: 100px; float: left;" >
       <asp:Image ID="SearchImage" runat="server" ImageUrl="~/Images/search_64x52.png" />
      </div>
     </div>
    Obviously that is in an ASPX page but the style part is the same. Note the use of float left in both divs... which is pointed out in that link!

Thread Information

Users Browsing this Thread

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

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