This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > May 2005 > Styling the root element HTML





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Styling the root element HTML
Thomas Mlynarczyk

2005-05-24, 7:46 pm

Hi,

Can I style the root element (HTML) just like any other (and will it work as
expected) or are there restrictions to take into account?

Thanks in advance,
Thomas


Lars Eighner

2005-05-24, 7:46 pm

In our last episode,
<d703es$s6l$03$1@news.t-online.com>,
the lovely and talented Thomas Mlynarczyk
broadcast on comp.infosystems.www.authoring.stylesheets:

> Can I style the root element (HTML) just like any other (and will it work as
> expected) or are there restrictions to take into account?


What exactly would that accomplish that styling BODY or FRAMESET
would not?

--
Lars Eighner eighner@io.com http://www.larseighner.com/
War on Terrorism: History a Mystery
"He's busy making history, but doesn't look back at his own, or the
world's.... Bush would rather look forward than backward." --_Newsweek_
Barbara de Zoete

2005-05-24, 7:46 pm

On Tue, 24 May 2005 22:37:14 +0200, Thomas Mlynarczyk
<blue_elephant55@hotmail.com> wrote:

> Can I style the root element (HTML) just like any other (and will it work as
> expected) or are there restrictions to take into account?
>


You can style it (I did :-) ) All I encountered was that the bg-colour you set
for the html element will be the bg-colour for the browser viewport (found out
this is agreed upon behaviour). I found no other strange things.


--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'

Thomas Mlynarczyk

2005-05-25, 8:14 am

Also sprach Lars Eighner:

[color=darkred]
> What exactly would that accomplish that styling BODY or FRAMESET
> would not?



I want to have a background image and in addition on the left side a graphic
(say about 200px wide) as background for the menu. Both should stretch to
the full height of the viewport (even when the latter is being resized) or
the height of the document - whichever is greater. I can do the left side
graphic by assigning it as background image to the body with repeat-y. But
then the rest of the space could only be a single color (body's background
color) or I'd have to wrap the main background image in a div, but then it
would stretch only as far as the content goes. So I thought assigning the
main background image to the html element instead would solve the problem in
an elegant way.


Thomas Mlynarczyk

2005-05-25, 8:14 am

Also sprach Barbara de Zoete:


[color=darkred]
> You can style it (I did :-) ) All I encountered was that the
> bg-colour you set for the html element will be the bg-colour for the
> browser viewport (found out this is agreed upon behaviour).


Meaning that if I scroll or resize the viewport, I will "see the end" of the
background? I'd like to give HTML a background-image (and, for "imageless"
clients, a background-color as well) and expect it to behave as if it was
assigned to BODY instead, so I could assign two overlapping background
images (the one for the body "clipped" by "repeat-y").


Spartanicus

2005-05-25, 8:14 am

"Thomas Mlynarczyk" <blue_elephant55@hotmail.com> wrote:

>Can I style the root element (HTML) just like any other (and will it work as
>expected) or are there restrictions to take into account?


For documents served as text/html (including "xhtml" served as
text/html) it is recommended to style the body element, not the html
element. http://www.w3.org/TR/CSS21/colors.html#q2

--
Spartanicus
Harlan Messinger

2005-05-25, 7:58 pm

Lars Eighner wrote:
> In our last episode,
> <d703es$s6l$03$1@news.t-online.com>,
> the lovely and talented Thomas Mlynarczyk
> broadcast on comp.infosystems.www.authoring.stylesheets:
>
>
> What exactly would that accomplish that styling BODY or FRAMESET
> would not?
>


http://groups-beta.google.com/group...3344178669c4033

(http://tinylink.com/?hwDO8Ui7T7)
Thomas Mlynarczyk

2005-05-25, 7:58 pm

Also sprach Harlan Messinger:

>

http://groups-beta.google.com/group...oring.styleshee
ts/browse_frm/thread/5623f732af2ad0e1/f3344178669c4033?q=messinger+html+body
+red+background-color&rnum=2&hl=en#f3344178669c4033

I don't quite see the point. The code example produces a red canvas, as
expected. But as I precised, I want to do this:

html { background: #abc url(canvasbackground.jpg); }
body { background: url(leftsidebackground.jpg) repeat-y; } /* picture is
200px wide */



Thomas Mlynarczyk

2005-05-25, 7:58 pm

Also sprach Spartanicus:

> For documents served as text/html (including "xhtml" served as
> text/html) it is recommended to style the body element, not the html
> element. http://www.w3.org/TR/CSS21/colors.html#q2


In other words: to be on the safe side, I'd better not? :-(


Harlan Messinger

2005-05-25, 7:58 pm

Thomas Mlynarczyk wrote:
> Also sprach Harlan Messinger:
>
>
> http://groups-beta.google.com/group...oring.styleshee
> ts/browse_frm/thread/5623f732af2ad0e1/f3344178669c4033?q=messinger+html+body
> +red+background-color&rnum=2&hl=en#f3344178669c4033
>
> I don't quite see the point. The code example produces a red canvas, as
> expected.


In IE or Firefox it produces a green canvas with the body's background
appearing in red against it.

But as I precised, I want to do this:
>
> html { background: #abc url(canvasbackground.jpg); }
> body { background: url(leftsidebackground.jpg) repeat-y; } /* picture is
> 200px wide */


That should work like my example, with the addition of the background
images. Nothing wrong with it.
Christoph Päper

2005-05-25, 11:27 pm

Thomas Mlynarczyk schrieb:
>
> Can I style the root element (HTML) just like any other


Yes.

> (and will it work as expected)


No, not always.
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews