Forum Moderators: not2easy

Message Too Old, No Replies

Is there any way to put an image into external CSS?

Like a title image?

         

asdf5kc

2:19 am on Jul 16, 2004 (gmt 0)



I can't find anywhere that says how you can. I'm trying to make the title image be part of external CSS so that I don't have to put it into each page...but I can't figure out how. Can you help?

DrDoc

2:22 am on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld! [WebmasterWorld.com]

Use server side includes or some form of template based web site. This cannot (and should not) be done with CSS.

Rambo Tribble

3:00 am on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



An image can, however, be the background for an element and that can be set with CSS.

Krapulator

6:18 am on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>This cannot (and should not) be done with CSS.

If the main title of the page is included in the header image why shouldn't it be done with css like this:

h1{
width: whatever;
height: whatever;
background: url(/widgetworld_logo.gif);
font-size: 0;
}

<h1>Widget World</h1>

Instead of:

<img height="whatever" width="whatever" alt="Widget World">

This adheres to the semantic web and content/style seperation principles does it not?

createErrorMsg

11:29 am on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One, some people feel that the site logo is part of the site content and should be explicitly included in the html. Remember, accessibility requirements state that any images which deliver ANY information to the user must provide that same info in other ways. With an <img> tag in the body, the ALT attribute does it fine.

Two, if it is set as a background image on your page, it does not actually APPEAR anywhere in the official version of the page, meaning that search engines, screen readers and users with styles turned off will not have access to the logo and, therefore, the name of the site!

You have to at least provide alternative methods of delivering the information that is in the image.

(That said, if your logo is in the background, it leaves your first H1 tag free to be the first "thing" on the page, reportedly helping SEO...what to do, what to do...)

TheBlueEyz

7:48 am on Jul 26, 2004 (gmt 0)

10+ Year Member




Two, if it is set as a background image on your page, it does not actually APPEAR anywhere in the official version of the page, meaning that search engines, screen readers and users with styles turned off will not have access to the logo and, therefore, the name of the site!

You have to at least provide alternative methods of delivering the information that is in the image.

This is what I usually do. The content of the header is an <h1> that contains the website name and slogan. Then I use image replacement to place the logo as a background image.

That way, the same information is delivered to users of both methods.