CSS Question

Discussion in 'HTML & Website Design' started by gerdywerdy, Aug 20, 2008.

  1. #1
    Hi there

    I have a question with regards to CSS

    I am using a css template for my site which divides the page into a header, content and footer

    in the header there is an image for a banner so each p-age will have this image in the top.

    my question is

    can i assign an alt value for this as for SEO purposes I am oloosing an alt tag on every page.

    is this possible to do

    many thanks

    Gerard
     
    gerdywerdy, Aug 20, 2008 IP
  2. CaveBoss

    CaveBoss Active Member

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #2
    I'm not sure I understand very well what you mean. Do you want to show a text image (logo), but still let search engines know the text contained in it?

    I think an alt attribute could help. Something like this:

    <img src="banner.gif" alt="name-of-the-banner" />
    Code (markup):
    So, when search engines crawl your site, they would "understand" the image.


    If you have a text image as your logo and still want to use a H1 tag for your title so that search engines can read it, using CSS, you could put the image in the background of the h1 tag and make the H1 text invisible to people by using a negative text-indent value.

    If that's what you want, I will post how to do it. Just let me know.
     
    CaveBoss, Aug 20, 2008 IP
  3. gerdywerdy

    gerdywerdy Member

    Messages:
    381
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    35
    #3
    hi there the image is in the external css file (see code below) I want to assign an ALT value in the css if its possible

    /*BANNER*/
    #banner {
    float : left;
    width : 720px;
    height : 200px;
    margin-left: 0px;
    padding : ;
    margin-bottom : 0;
    background : #eee url(img/header2.gif);
    }
    #banner h1 {
    margin : 140px 0 0 20px;
    font : normal 2em georgia, verdana, arial, tahoma, sans-serif;
    text-transform : none;
    letter-spacing : 3px;
    color : #ffffff;
    background : transparent;
     
    gerdywerdy, Aug 20, 2008 IP
  4. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You can't do it. Need to move the image out into the Html of the page and insert your ALT text there.

    There may be an anchor link around the #banner div in your Html however. You could apply the TITLE attribute to the anchor link.

    Example

    <a href="linktohomepage" title="My homepage with some keywords here"><div id="banner"><h1>My Homepage</h1></div></a>
    Code (markup):
     
    Dodger, Aug 20, 2008 IP
  5. newmannewy

    newmannewy Active Member

    Messages:
    349
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #5
    yep if ur using CSS to display the image u lose the right to use an aLT tag. .but i wouldnt worry too much .. it wont affect SEO by that much
     
    newmannewy, Aug 20, 2008 IP
  6. gerdywerdy

    gerdywerdy Member

    Messages:
    381
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    35
    #6
    ok

    thanks for the helps guys

    all the best

    Gerard
     
    gerdywerdy, Aug 21, 2008 IP
  7. nicangeli

    nicangeli Peon

    Messages:
    828
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You should only add images from within your CSS file if they are for presentational purposes only. So it would make no sense to add an alt tag to them.

    If your image is part of your content, then I would add it using <img>.

    N.B. This is only MY way of doing things, I know there are some members of these forums who will probably disagree with me.
     
    nicangeli, Aug 21, 2008 IP
  8. The_Studio

    The_Studio Peon

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    use images in css for background or custom built points on list etc..
    if you need images on content, insert it in the HTML
     
    The_Studio, Aug 21, 2008 IP
  9. ferman

    ferman Well-Known Member

    Messages:
    968
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    140
    #9
    you can't assign alt value in css...simple is that
     
    ferman, Aug 22, 2008 IP