We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,659 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

2 column layout issue when using borders

Hello all,

I'm new to CSS layouts and am trying to create a two column layout within a wordpress page. The left and right column line up as expected until I add border-left and padding into the mix found within div#mediaPhotos. After adding it, the right div is still on the right but isn't aligned with the top of the page. It's found all the way at the bottom. Here's the HTML:

<div id="mediaContent">
    <div id="mediaVideos">
        a bunch of text and videos can be found here
    </div> <!-- end id=mediaVideos -->

    <div id="mediaPhotos">
        a bunch of text and images are found here
    </div> <!-- end id=mediaPhotos -->

    <div class="mediaCleared"></div>

</div> <!-- end id=mediaContent -->

Here's the CSS:

div#mediaContent {
    height:100%;
    width:100%;
}

div#mediaVideos {
    display:inline-block;
    height:100%;
    width:70%; 
    float:left;
}

div#mediaPhotos {
    display:inline-block;
    width:30%; 
    height:100%;
    float:right;
    border-left: 2px dotted #51303f;
    padding: 15px;
}

div.mediaCleared {
    clear: both;
}

Thanks guys

2
Contributors
3
Replies
3 Hours
Discussion Span
9 Months Ago
Last Updated
4
Views
loligator
Light Poster
35 posts since Sep 2008
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0

Did you remember to increase the width of the column to compensate for the additional 34px (border and padding)? Don't forget you boxmodel: Click Here

Helianthus
Junior Poster in Training
64 posts since Jul 2012
Reputation Points: 12
Solved Threads: 2
Skill Endorsements: 0

damn, i feel stupid. that's what the issue was. i assumed because i was using percentages it would have adjusted for that. i was wrong!

loligator
Light Poster
35 posts since Sep 2008
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0

I doubt you are stupid :) Don't forget to close this discussion.

Helianthus
Junior Poster in Training
64 posts since Jul 2012
Reputation Points: 12
Solved Threads: 2
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0743 seconds using 2.84MB