Friday, 6 December 2013

CSS : Hiding text using text-indent


Hiding text using text-indent

Lets say you have an image you are using for your websites logo. This image will be inside an h1 tag, which is good for SEO, however, we also want to have our text title written in the h1 tags so the search engines can read it easily. Some may be tempted to use “display:none” on an element. Unfortunately, we would have to separate the image logo from the h1 tag if we used this technique. Using text-indent and negative values, we can get passed this like so.

h1 { text-indent:-9999px;/*Hide Text, keep for SEO*/ margin:0 auto; width:948px; background:transparent url("images/header.jpg") no-repeat scroll; }

This will ensure that all text is not visible on any resolution while allowing it stay inside the h1 element containing the logo. 



No comments:

Post a Comment

Physics basic inventions and inventors

1.Which instrument is used to measure altitudes in aircraft's ? Audiometer Ammeter Altimeter Anemometer Explanation : ...