By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,678 Members | 1,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,678 IT Pros & Developers. It's quick & easy.

Styling the root element HTML

P: n/a
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
Jul 21 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
In our last episode,
<d7*************@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 ei*****@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_
Jul 21 '05 #2

P: n/a
On Tue, 24 May 2005 22:37:14 +0200, Thomas Mlynarczyk
<bl*************@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 |
`-------------------------------------------------- --<--@ ------------'

Jul 21 '05 #3

P: n/a
Also sprach Lars Eighner:
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?

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.
Jul 21 '05 #4

P: n/a
Also sprach Barbara de Zoete:

Can I style the root element
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").
Jul 21 '05 #5

P: n/a
"Thomas Mlynarczyk" <bl*************@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
Jul 21 '05 #6

P: n/a
Lars Eighner wrote:
In our last episode,
<d7*************@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?


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

(http://tinylink.com/?hwDO8Ui7T7)
Jul 21 '05 #7

P: n/a
Also sprach Harlan Messinger:

http://groups-beta.google.com/group/...ring.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 */

Jul 21 '05 #8

P: n/a
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? :-(
Jul 21 '05 #9

P: n/a
Thomas Mlynarczyk wrote:
Also sprach Harlan Messinger:
http://groups-beta.google.com/group/...ring.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.
Jul 21 '05 #10

P: n/a
Thomas Mlynarczyk schrieb:

Can I style the root element (HTML) just like any other
Yes.
(and will it work as expected)


No, not always.
Jul 21 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.