13 replies [Last post]
exmk
Offline
newbie
Last seen: 17 years 7 weeks ago
Joined: 2005-12-21
Posts: 5
Points: 0

Hi,

I did a search on this forum & google for help but everything I tried didn't work. I'm new to css, and I have no idea what I'm doing..

I worked out how to make a style switcher, but I would like to change my banner with every style. If anyone could help me I'd appreciate it a lot.

My site is http://exmk.mkoutworld.net/

Thanks.

larmyia
Offline
Elder
London
Last seen: 14 years 21 weeks ago
London
Timezone: GMT+1
Joined: 2005-01-25
Posts: 1060
Points: 0

Image Banner help..

hello and welcome to the forum.

hrmm...no doctype and tables based. welcome to the world of css. let me assure you that you're not making the most of it. and when you've fixed your doctype issues (and hopefully your layout ones), please validate.

back to your question. a stylesheet switcher changes the style of the page, not the html of it. if you want to do that you're going to have to use another method. however, if you used your img as a background one in your css, then it'd be simple to change...just use a different one with the different stylesheet.

hth. if not lmk. I'm not sure you've got the whole idea about the stylesheet switcher and how it works. but if you do dont' want to blether on...

btw, get all the above sorted and I think you could have a good site, infront and behind!

larmyia

exmk
Offline
newbie
Last seen: 17 years 7 weeks ago
Joined: 2005-12-21
Posts: 5
Points: 0

Image Banner help..

Quote:
I'm not sure you've got the whole idea about the stylesheet switcher and how it works.

Probably not Tongue , but I think I understand enough to do what I'd like, apart from the banner. I can get the full sites colours changing like I want, but I removed all that for now so I can work on the banner thing.

Could you please explain to me how to ge the background image thing working? That's all I could find on google and these forums, but everything I tried failed. I'm probably just doing something simple wrong lol..

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 8 years 17 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Image Banner help..

Instead of putting the image in your HTML, you attach it to an element like this:

#yourDiv {
	width: XXpx; 
	height: XXpx; /* height & width need to be at least the size of your image */
	background: url(yourImage.jpg) no-repeat;
}

Then for each different stylesheet, you'd have a different background image for that div.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

exmk
Offline
newbie
Last seen: 17 years 7 weeks ago
Joined: 2005-12-21
Posts: 5
Points: 0

Image Banner help..

I have to put something in my html for that to show up though? That's the part that always confuses me. I'm hopeless lol..

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 8 years 17 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Image Banner help..

Yeah, you need an element named the same as what you've got in your CSS. So from my example:

<div id="yourDiv></div> (Although it's generally not recommended to have empty elements.)

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

exmk
Offline
newbie
Last seen: 17 years 7 weeks ago
Joined: 2005-12-21
Posts: 5
Points: 0

Image Banner help..

Thanks, I'll try that out!

edit: I got it to work, Thanks! Laughing out loud

kh7
Offline
newbie
Netherlands
Last seen: 17 years 7 weeks ago
Netherlands
Timezone: GMT+1
Joined: 2005-12-21
Posts: 10
Points: 0

Image Banner help..

exmk wrote:
I have to put something in my html for that to show up though? That's the part that always confuses me. I'm hopeless lol..

Sounds to me you are in over your head then. If HTML confuses you, CSS isn't going to be easy either. I think it is pretty ambitious to want to already switch styles, have a CSS layout and you probably have no idea what a doctype is either.
I'd advice trying CSS only for things like the fonts and so forth before going into css-layouts.
Anyhow the doctype you'll be wanting is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> put that in your HTML before the rest of the code.

good luck.

larmyia
Offline
Elder
London
Last seen: 14 years 21 weeks ago
London
Timezone: GMT+1
Joined: 2005-01-25
Posts: 1060
Points: 0

Image Banner help..

why transitional??? if starting from scratch why not strict???

exmk
Offline
newbie
Last seen: 17 years 7 weeks ago
Joined: 2005-12-21
Posts: 5
Points: 0

Image Banner help..

HTML doesn't confuse me, it was jus that one thing. I understand the doctype stuff, but I haven't gotten around to doing everything right yet. Thanks for the help, though. Laughing out loud

larmyia
Offline
Elder
London
Last seen: 14 years 21 weeks ago
London
Timezone: GMT+1
Joined: 2005-01-25
Posts: 1060
Points: 0

Image Banner help..

I know what you're saying, but the doctype should be the first thing you do when coding a site. before anything else. if you do a site and then try and put a doctype in you will find innumerable problems and will probably have to go back to the drawing board...

kh7
Offline
newbie
Netherlands
Last seen: 17 years 7 weeks ago
Netherlands
Timezone: GMT+1
Joined: 2005-12-21
Posts: 10
Points: 0

Image Banner help..

larmyia wrote:
I know what you're saying, but the doctype should be the first thing you do when coding a site. before anything else. if you do a site and then try and put a doctype in you will find innumerable problems and will probably have to go back to the drawing board...

That really depends. I've created a new site recently with a combination of NVU and typed coding and it does not have a correct doctype (NVU changes correct doctypes back into incorrect ones Sad ) - still the site validates (tentatively).
If you know what you're doing, doctype doesn't seem that important. Doctype is important for the validator to know what it is reading. But it really isn't that important if your code is correct. [Yes I know, this is highly controversial of me, still based on some solid reading]

http://www.palliatiefutrecht.nl/ (very small at the moment, but it will grow into a multi-page site) [Tentatively passed validation]

I could use a free WYSIWYG editor that DOES give a correct doctype though. Since I'm moving towards standards-based web-editing it is a bit weird to have a correct site - except for the doctype...
Any suggestions :?:

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 41 weeks 2 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Image Banner help..

kh7 wrote:

If you know what you're doing, doctype doesn't seem that important. Doctype is important for the validator to know what it is reading. But it really isn't that important if your code is correct. [Yes I know, this is highly controversial of me, still based on some solid reading]

Hugo knows a lot more abotu this than me, and we had a long discussion about it a little while ago, before you joined. You're right in a way, but a complete doctype is needed to force IE into Standards Mode.

You're correct, if you write valid code Firefox will display it fine without a doctype. It's just something you should have in there Laughing out loud

Verschwindende wrote:
  • CSS doesn't make pies

larmyia
Offline
Elder
London
Last seen: 14 years 21 weeks ago
London
Timezone: GMT+1
Joined: 2005-01-25
Posts: 1060
Points: 0

Image Banner help..

and frankly validation helps write better code. at the end of the day, if you're doing big sites mistakes are made. with a valid doctype to work to it's 100% easier to check mistakes.

so, if you're the best code writer ever, fine, maybe doctypes aren't strictly needed, but for most of us it really helps.

but as tph says, Hugo is the guru on this subject.