Page 1 of 1
web: image in css
Posted: Wed Apr 13, 2005 11:28 am
by blissard
hey, i'm trying to learn some css, and encountered a small problem.
how can i set an image in css with the class-command?
i.e:
in the php-file.
and then in the css-file: (this is the part where i got it wrong)
Code: Select all
.header {
image : url("gfx/header_01.gif");
}
Posted: Wed Apr 13, 2005 12:57 pm
by NRGizeR
why use css for that?
or if you want to do some funky stuff (such as adding borders, doing absolute placing etc) with css, use
Code: Select all
<img src="gfx/header_01.gif" class=header>
and add the stuff you want to the css file (ex border, top, left, position, etc) ...
Posted: Wed Apr 13, 2005 12:59 pm
by NRGizeR
oh, and if you want to learn css properly there are great tutorials and a complete css2 reference at
http://www.w3schools.com/css/default.asp
Posted: Wed Apr 13, 2005 2:10 pm
by blissard
i know how to place an image, just not with css.
i want the page to change with different css-files, mainly colors, but also some images.
i used this one:
together with this one:
Code: Select all
.TD_BORDER {
background-image: url("gfx/border.gif");
}
which works fine..
Posted: Wed Apr 13, 2005 2:12 pm
by NRGizeR
It sounds to me as if you've misunderstood the purpose of css somewhat, but I could be mistaken... try to read the reference/tutorials... those will help...
Posted: Wed Apr 13, 2005 2:20 pm
by blissard
look, i'm putting as much as possible into the css-file. so if i make another css-file with changed colors, and changed images, the look of the page will change with it. kinda like a skin.
i just want to know how to set the src for an image through css, so if i have different src in different css-files, the img will change.
Posted: Wed Apr 13, 2005 5:15 pm
by blissard
no matter, i used the picture as a tablecell-background, like i did with the border. but if anyone knows how to use it without a table, tell me
Posted: Thu Apr 14, 2005 1:23 am
by NRGizeR
if you would have checked the reference....... you would have realized that there is no (spoon)/image tag in css
you can however, do what I think you'd like to do with a <div> tag and a background-image entry in css, and if you want to use more "pure" css, I would suggest going down this path instead of using tables...
Posted: Thu Apr 14, 2005 4:38 am
by blissard
indeed, i certainly had a hard time finding one.
i'm such a sucker for tables, i fell in love with them many years ago. but we also hates them, yes, as they behave differently in firefox, opera and ie.
Posted: Wed Aug 03, 2005 2:51 am
by Guenhwyvar
Do it with <div> and background-image.
:))))
Posted: Wed Aug 03, 2005 5:28 am
by impressiVe
Wtf i thought you wanted to play counterstrike source xD.. Luck for you m8 ^^