SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Using %width

Threaded View

  1. #1
    SitePoint Member flannel jesus's Avatar
    Join Date
    Nov 2012
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using %width

    Let's say I have two div inside another:

    HTML Code:
    <div class="outside">
    <div class="inside">
    </div>
    <div class="inside">
    <div class="clear"></div>
    </div>
    And let's say I want my inside-divs to be the exact same width as each other, but the outside div has a border and padding.

    Code css:
    .clear {
    clear:both;
    }
     
    .outside {
    width:400px;
    border:1px;
    padding:9px;
    }
     
    .inside {
    padding:0px;
    margin:0px;
    width:50%;
    float:left;
    }

    Will the width calculation for the .inside take into account the border and padding? Will it be 50% of 400 (200 px wide) or will it be 50% of (400-border-padding) = 50% of 380 = 190px wide?
    Last edited by Stevie D; Dec 8, 2012 at 05:10. Reason: Code tags added


Bookmarks

Posting Permissions

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