basic div height problem

C

Ciaran

Anyone know off hand how to make this work?

<body>
<div style="background:#000000; height:50%;"></div>
</body>

The div heaight doesn't work.
Cheers,
Ciarán
 
J

Jonathan N. Little

Ciaran said:
Anyone know off hand how to make this work?

<body>
<div style="background:#000000; height:50%;"></div>
</body>

The div heaight doesn't work.

50% of what? You did not specify, add to your stylesheet and see what
happens

HTML, BODY { height: 100%; }

Take care,

Jonathan
 
J

Jukka K. Korpela

Scripsit Ciaran:
Anyone know off hand how to make this work?

<body>
<div style="background:#000000; height:50%;"></div>
</body>

Work in which sense?
The div heaight doesn't work.

Key question: 50% of _what_?

To make the situation more definite, set

html, body { height: 100%; margin: 0; padding: 0; }
 
C

Ciaran

Scripsit Ciaran:



Work in which sense?


Key question: 50% of _what_?

To make the situation more definite, set

html, body { height: 100%; margin: 0; padding: 0; }

Cheers guys but I tried that already. The following doesn't work
either, the div still is only the height of a line of type.

<body style="height: 100%; margin: 0; padding: 0; ">
<div style="background:#000000; height:50%;"></div>
</body>
 
J

Jonathan N. Little

^^^^ ^^^^

Set *both* the BODY *and* its parent HTML element
Cheers guys but I tried that already. The following doesn't work
either, the div still is only the height of a line of type.

<body style="height: 100%; margin: 0; padding: 0; ">
<div style="background:#000000; height:50%;"></div>
</body>

You *only* set the BODY to 100% of what?
 
C

Ciaran

^^^^ ^^^^

Set *both* the BODY *and* its parent HTML element


Cheers guys but I tried that already. The following doesn't work
either, the div still is only the height of a line of type.
<body style="height: 100%; margin: 0; padding: 0; ">
<div style="background:#000000; height:50%;"></div>
</body>

You *only* set the BODY to 100% of what?


Ah excellent, thanks! I never knew you could style the html tag!
imagine!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top