Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting different font sizes in css sheet

    Hi,

    A question from a complete novice struggling with css: I have a set of keywords at the top of my page, in a very small font and the same colour as the page background, to make them invisible to page viewers, but visible to search engines.

    However I obviously want the ordinary page text under it to be in a different font. How do I code that, and can I put the second piece of coding into the same css file? The stylesheet tag I have for the small text is below. Thanks for any help. John.

    p {font-family: Verdana, Arial, Helvetica, Sans-Serif; color: #FFFFFF; font-size: 25%; }

  • #2
    Senior Coder chilipie's Avatar
    Join Date
    Jul 2004
    Location
    Shrewsbury, UK Age: 16
    Posts
    1,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could use classes to produce the desired effect:

    Code:
    div.invis {
    display: none;
    }
    
    p {
    /* Stuff to style your normal paragraphs. */
    }
    
    .....
    
    <div class="invis">
    <p>keywords, go, here</p>
    </div>
    
    <p>This is where all of the visible text would go!</p>

    display: none
    is a more effective way of doing what you were attempting - basically, anything between the div tags with a class of invis will not appear on your page at all.

    Please note that some search engines will "blacklist" your site if they find you using hidden keywords...
    Last edited by chilipie; 02-12-2005 at 01:56 PM. Reason: Typo.

  • #3
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by chilipie
    Please note that some search eninges will "blacklist" your site if they find you using hidden keywords...
    Not to mention the massive annoyance to screenreaders, text browsers, legacy browsers, etc... (although I guess in most cases "display: none" wouldn't show up in screen readers, right?) Just an opinion, but this just kinds of rubs against the whole standards-based-semantic-web thing...

  • #4
    New Coder
    Join Date
    Feb 2005
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks chaps,

    I think on reflection I'll leave that small font tag as it is and just use html font tags to format the visible text. That 'invisible' tag probably would be frowned on by some search engines. Cheers.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •