Web Design Forum: Using images for titles - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using images for titles Image in HTML, or background in CSS?

#1 User is offline   mrsminkie 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-December 09
  • Reputation: 21
  • Gender:Female
  • Location:South Yorkshire
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 06 January 2010 - 07:17 PM

I like to use images for my main titles. Advice on this site with one I was struggling to layout was to set the image as a background. There is text set as display:none underneath. I have some titles however as images within the html, with titles, so that when you hover over them you get alt text.

What is the correct/best way to be doing this as far as SEO and accessability goes?

thanks
0

#2 User is offline   taffybach 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 25
  • Joined: 05-January 10
  • Reputation: 0
  • Gender:Male
  • Location:Lincolnshire, UK
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 06 January 2010 - 07:33 PM

You're on the right track. Most search engines do index the ALT tag so this will help and I always esnure that any images used display an ALT text.
0

#3 User is offline   mrsminkie 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-December 09
  • Reputation: 21
  • Gender:Female
  • Location:South Yorkshire
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 06 January 2010 - 07:36 PM

Thank you. But which method should I use, or does it not matter so long as images have titles, and background images has hidden text?
0

#4 User is offline   Stardog 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 91
  • Joined: 09-April 08
  • Reputation: 1
  • Location:Edinburgh
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 06 January 2010 - 09:38 PM

I would do something like:

h1 {
background: url(img.gif);
text-indent: -9999px;
}

There shouldn't be any need for tooltips when you hover over any headers. I think img titles mostly help google image search, which I doubt you want headings showing up in.

Screenreaders will also read the indented text.
0

#5 User is offline   mrsminkie 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-December 09
  • Reputation: 21
  • Gender:Female
  • Location:South Yorkshire
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 06 January 2010 - 10:20 PM

View PostStardog, on 06 January 2010 - 09:38 PM, said:

I would do something like:

h1 {
background: url(img.gif);
text-indent: -9999px;
}

There shouldn't be any need for tooltips when you hover over any headers. I think img titles mostly help google image search, which I doubt you want headings showing up in.

Screenreaders will also read the indented text.


That's what I was doing. But then I was advised on here to hide the text using display:none. That makes the image disappear so I have to split it up and have a div/class for each heading and have a background image for the div/class and then hide the html text. Seems messy.
0

#6 User is offline   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,813
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 07 January 2010 - 12:30 AM

In google's webmaster guidlines they recommend not hiding text from a users view and having hidden text purely for seo - which is in essence what you're doing with a negative text indent. This is quite a grey area on the web.

Using an empty span tag is quite popular:

<h1 class="meh">
 <span></span>seo spam

h1.meh {
 width: 350px; height: 75px;
 position: relative;
 }
 h1.meh span {
 background: url("image.jpg");
 position: absolute;
 width: 100%;
 height: 100%;
 }



There are loads of image replacement methods described here.
0

#7 User is offline   mrsminkie 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 588
  • Joined: 23-December 09
  • Reputation: 21
  • Gender:Female
  • Location:South Yorkshire
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 07 January 2010 - 10:32 AM

View Postrallport, on 07 January 2010 - 12:30 AM, said:

In google's webmaster guidlines they recommend not hiding text from a users view and having hidden text purely for seo - which is in essence what you're doing with a negative text indent. This is quite a grey area on the web.

Using an empty span tag is quite popular:

<h1 class="meh">
 <span></span>seo spam

h1.meh {
 width: 350px; height: 75px;
 position: relative;
 }
 h1.meh span {
 background: url("image.jpg");
 position: absolute;
 width: 100%;
 height: 100%;
 }



There are loads of image replacement methods described here.


Thanks I'll have a look and give it a go.
0

#8 User is offline   Stardog 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 91
  • Joined: 09-April 08
  • Reputation: 1
  • Location:Edinburgh
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 07 January 2010 - 12:42 PM

Some of the most well-known web designers I know use text-indent. If it's not a picture then they'll embed the font into the site itself:

http://www.31three.com
<h1><span class="text_hide">Creative services for the design challenged developer</span></h1>

display:block; text-indent:-9999px;

http://thingsthatarebrown.com
text-indent on the nav li.
0

#9 User is offline   MrBrightside 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 855
  • Joined: 05-May 09
  • Reputation: 25
  • Gender:Male
  • Location:In the Diary of Jane
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 07 January 2010 - 01:17 PM

I tend to use text-indent, but also have <span> tags inside those headings. The span tags don't do anything at the moment but the point in having them is for future-proofing; if text-indent does become penalised I could easily switch to an alternate method of hiding the text using CSS instead of having to edit all my HTML files.

Of course, CSS3 comes with an nice and elegant solution:
h1 { content: url('image.png'), your_text }

which displays image.png but also allows you to specify the hidden text. So hopefully text-indent will last until CSS3 becomes common.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users