AUTHOR

klint/herc/cssgurus

i need halp.
halp, she neds it
for some reason i can't get an image contained in body:before to center. i don't know if that's like impossible or something, but i've tried several different things and they all end badly

css:

body:before {
content: url("header.png"Smiley;
margin: 0 auto;
}

...ideas?
neutralmilk quote:
halp, she neds it
she needs it, help
Evisceration quote:
wrap it in a div and assign it a specific class like .header{}
i can't, the nature of body:before is that it doesn't exist outside of the css
:before is an element, kinda like :hover for a link. doesn't exist outside of the stylesheet
Evisceration quote:
oh fuck now i know what you're doing
Smiley
archipelago quote:
:before is an element, kinda like :hover for a link. doesn't exist outside of the stylesheet
Pseudo-class.
Sorry, pseudo-element.
Tychon quote:
Sorry, pseudo-element.
exactly
help me, tychie. Smiley
(Though they're the same thing, I think it's just a new terming.)
I'm thinking, hush.
Oh, heh. It has no idea how wide it is. So width is just 100% by default -- which means center will always visually appear as being just the image normally showing up on the left.
Give it the width of the image and it should figure something out and you can work from there.
I'm seeing results with this:

body:before
{
display: block;
content: url(http://www.google.com/intl/en_ALL/images/srpr/logo1w.png);
margin: 0px auto;
width: 275px;
}


Are you not getting anything, Klint?
Oh yeah, block-level display helps, too.
Evisceration quote:
display: block; did it

fuck, you are a god.
i tried this but i want it to always be centered, and i feel like defining an absolute width is going to fuck with that

Quick reply

Sign in to post a message.
Smileys

Times shown in Eastern Time (ET).