A
Alan Cole
I've been 'playing' with css layout recently and have been using
background images for specific <divs> to control the layout of section
headers.
So, for example a hypothetical div called 'about this page' will have a
pretty background image containing the words 'about this page'
e.g.
#about_this_page h2
{
background: #59365f url(images/about_this_page.gif) no-repeat;
}
(positioning etc. has been omitted)
If I was using a similar technique with a table layout I would give the
particular cell a background_image and also give that image the ALT text
alt="about this page"
So my questions are:
Is there a way to assign alternative (alt) text to a background image in
CSS?
If so how?
If not, what is the accepted way to provide alt text in such
circumstances using css?
At the moment I have been setting up another style for a <span> element
within the about_this_page div (sorry if the terminology is wrong) that
basically pushes the text off the screen... will screen readers / text
only browsers 'see' this text?
e.g.
#about_this_page h2 span
{
text-indent: -2000px;
margin: 0;
padding: 0;
}
so the html becomes:
<div id="about_this_page">
<h2><span>About This Page</span></h2>
</div>
I hope that makes sense.
Al.
background images for specific <divs> to control the layout of section
headers.
So, for example a hypothetical div called 'about this page' will have a
pretty background image containing the words 'about this page'
e.g.
#about_this_page h2
{
background: #59365f url(images/about_this_page.gif) no-repeat;
}
(positioning etc. has been omitted)
If I was using a similar technique with a table layout I would give the
particular cell a background_image and also give that image the ALT text
alt="about this page"
So my questions are:
Is there a way to assign alternative (alt) text to a background image in
CSS?
If so how?
If not, what is the accepted way to provide alt text in such
circumstances using css?
At the moment I have been setting up another style for a <span> element
within the about_this_page div (sorry if the terminology is wrong) that
basically pushes the text off the screen... will screen readers / text
only browsers 'see' this text?
e.g.
#about_this_page h2 span
{
text-indent: -2000px;
margin: 0;
padding: 0;
}
so the html becomes:
<div id="about_this_page">
<h2><span>About This Page</span></h2>
</div>
I hope that makes sense.
Al.