i need halp.
AUTHOR
klint/herc/cssgurus
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"
;
margin: 0 auto;
}
...ideas?
css:
body:before {
content: url("header.png"
;margin: 0 auto;
}
...ideas?
neutralmilk quote:
halp, she neds it
she needs it, help
Evisceration quote:i can't, the nature of body:before is that it doesn't exist outside of the css
wrap it in a div and assign it a specific class like .header{}
: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
archipelago quote:Pseudo-class.
:before is an element, kinda like :hover for a link. doesn't exist outside of the stylesheet
Sorry, pseudo-element.
Tychon quote:exactly
Sorry, pseudo-element.
help me, tychie.
(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:
Are you not getting anything, Klint?
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: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
display: block; did it
fuck, you are a god.
Quick reply
Sign in to post a message.Times shown in Eastern Time (ET).
