473,379 Members | 1,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Why the height of containing block is zero?

I write the following code:
xhtml:
<body>
<div id="header">
<h1>Welcome to site</h1>
<div>
<a href="">site in English</a>
hello,please <a href="">login</a> or <a
href="">register</a>
</div>
</div>
</body>

css:
#header {
background-color: #FFE4B5;
}
#header h1 {
float: left;
margin: 0;
}
#header div {
float: right;
}

The problem is that the header div's background color is not displayed.
It found that it's height is zero, and padding is also zero. I refer
to CSS2 specification, it says that height's default value is auto. I
think it means that the height depends on its content's height, i.e.
the h1 and div's height in this case. I don't want to specify the
height explictly. What's wrong with me? How can I solve it? TIA.

May 14 '06 #1
2 1575
ha******@gmail.com wrote:
}

The problem is that the header div's background color is not displayed.
It found that it's height is zero, and padding is also zero. [...]

It is because there is no content. It has been floated out.
See <http://positioniseverything.net/easyclearing.html>.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
May 14 '06 #2
thanks. I got it.

May 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Secret Guy | last post by:
Because of my experience posting various places over the last couple of weeks: I'm expecting to be greated with hostility for asking about concepts instead of "practical" things, since that has...
11
by: Chris Beall | last post by:
Here's the problem: http://pages.prodigy.net/chris_beall/Demo/theproblem.html The page contains inline text, then some additional pairs of text which are floated right and left. (This is a...
18
by: Francois du Toit | last post by:
Can someone confirm this: http://www.purpleray.za.net/opera_bug.html
6
by: Martin Plotz | last post by:
Dear Newsgroup, I would like to have a page with a footer on the bottom of the page with a fixed height. The upper part should have the remaining height. In frames I could achieve this with "*" as...
11
by: RTrigaux | last post by:
Hello all, I have a page setup with blocs of texts (div with margins, background colors and all). For one of these blocks, I need two columns. Their height is not predictible. The simple CSS...
3
by: Q. John Chen | last post by:
I have a page contains a table (e.g a 3-row table). The middle row is for the content and the bottom row is for footer notes. When the middle row does not have much info, the footer goes way too...
3
by: ianv2 | last post by:
Hi I have a div which contains my local navigation bar, which has a blue background and is next to the content div, at the moment however this blue background colour stops after the unordered...
2
by: Dag Sunde | last post by:
I have the following function to resize a div element (Content) depending on the size of another div element (leftConent). function adjustContentHeight() { var content =...
1
by: astrochelonian | last post by:
Hello, all, First time I post, so I beg for everyone's patience. I am writing because I have the following doubt. in the page http://atuin.no-ip.org, you can see a blue-grey bar stretching...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.