Results 1 to 5 of 5

Thread: [vs2005] how to set div container width

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    [vs2005] how to set div container width

    Hi team, when you have multiple images and you want to contain it in div how you get the total div width. My understanding is that you sum all image width and you will have the div container width. But that did work for me in vs design environment.

    CSS
    Code:
    #search{background:green;float:left;width:73px;height:34px;}
    #logout{background:green;float:left;width:73px;height:34px;}
    #web{background:green;float:left;width:72px;height:34px;}
    #email{background:green;float:left;width:74px;height:34px;}
    #clear{clear:both;}
    HTML
    Code:
    <div style="width:292px; height:34px; float:left;">
    <div id="search"><img src="_images/search.jpg"  alt="search" /></div>
    <div id="logout"><img src="_images/logout.jpg"  alt="logout" /></div>
    <div id="web"><img src="_images/web.jpg"  alt="web" /></div>
    <div id="email"><img src="_images/email.jpg"  alt="email" /></div>
    <div class="clear"></div>
    Learn something new every .001 second.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: [vs2005] how to set div container width

    you have borders on the right side of every div you're using, it looks like. borders add to the width of something, just as padding does. if you have a 1 pixel border on one side of the element, that's +1 pixel width for every element. if you have a 1 pixel border on both sides of one element, that's +2 pixel width for every element. try compensating for the border that would be added by increasing your container's width by 4 pixels (you have 4 image divs).
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Re: [vs2005] how to set div container width

    hey, I don not require border on that divs on the first place so by setting border:0px will clear all that it is.

    thanks.
    Learn something new every .001 second.

  4. #4
    Hyperactive Member coothead's Avatar
    Join Date
    Oct 2007
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    285

    Re: [vs2005] how to set div container width

    Hi there jlbantang,

    your code appears to be an excellent example of 'Divitis'
    Check out the symptoms here...


    Take a look at the attachment for a semantic rendering of the code.
    Attached Files Attached Files


    ~ the original bald headed old fart ~

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Re: [vs2005] how to set div container width

    hey,

    nice post. hoping to find the cure the soonest time. like im 80&#37; complete of the project and now i have to reconstruct markups again... tough job... nonetheless like it as well.
    Learn something new every .001 second.

Posting Permissions

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



Click Here to Expand Forum to Full Width