Solved

div tag being pushed down

Posted on 2011-02-23
4
210 Views
Last Modified: 2012-05-11
I want to have a sidebar and main contents to display all the way at the top of the page.  However-only sometimes-(iE8) the main content has a large white space and starts displaying only below the sidebar content,
.twoColHybLt #container { 
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	text-align: left; /* this overrides the text-align: center on the body element. */
} 
.twoColHybLt #sidebar1 {
	float: left; 
	width: 18%; /* since this element is floated, a width must be given */
	padding: 0px 0;  /*top and bottom padding create visual space within this div  */
}
.twoColHybLt #sidebar1 h3, .twoColHybLt #sidebar1 p {
	margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
	margin-right: 10px;
}

.twoColHybLt #mainContent { 
	margin: 0 20px 0 12em;  /*the right margin can be given in percentages or pixels. It creates the space down the right side of the page. */
	  
}

Open in new window

0
Comment
Question by:JSCF
  • 3
4 Comments
 
LVL 16

Expert Comment

by:HagayMandel
Comment Utility
It happens because the sidebar div has a content component that is wider than it's with (18%)
To verify it, use overflow:hidden in the sidebar style.
0
 
LVL 16

Accepted Solution

by:
HagayMandel earned 500 total points
Comment Utility
It happens because the sidebar div has a content component that is wider than its width (18%)
To verify it, use overflow:hidden in the sidebar style.
[problems with my keyboard]
0
 

Author Comment

by:JSCF
Comment Utility
Why does it happen onl yin IE8?
0
 
LVL 16

Expert Comment

by:HagayMandel
Comment Utility
Cause other browsers usually crop the extra width.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now