Example the first. Headings of pages
The example of similar replacement can be seen on the majority of the basic pages of a site stopdesign.com. Pay attention to the main headings of each unit or page (for example, " Recent Log Entries " on the main page). They were created without manipulation with properties of the text with help CSS. These are images, ljubovno processed so that to correspond{meet} to a font of a trade mark. The special attention has been inverted on concurrence of background colors of images to a background of those parts of pages where they should be. Effect hardly perceptible, but integral for underlining{emphasis} individuality of a site.
Having had a look in an initial code of page or having disconnected tables of styles, you will see, that the image of heading is not a part of a marking of page. Actually, there, where the majority of you sees a heading - picture, there is usual teg <h1> inside which there is a plain text, i.e. the usual text html-heading borrowing{occupying} the usual position in hierarchy of page.
Voice browsers, devices with small screens, and search robots should (see notes at the end of clause{article}) to ignore any tables of styles used at a conclusion to the screen. Instead of it they receive the usual text placed in an element <h1>.
One of methods of binding of images - headings for sections of sites will consist in creation of a context in which these images - zagolovoki are used. In an element <body> each page of the certain unit to attributes id or class unique value is appropriated{given}. Then, using selectors of inheritance, to everyone tegu <h1> the corresponding image becomes attached depending on that in what context of an element <body> given teg <h1> appears (pair body*sectionForum h1 or body.sectionForum h1). But in each section of a site there can be some types of pages, and we can be necessary to create the headings corresponding to affiliated pages of sections.
It is much more reasonable to appropriate{give} to each heading the identifier id, containing the reduced name of this heading. For an example: heading Recent Log Entries on the main page stopdesign.com has the identifier "t-reclog". The prefix "t-" is added to create unique value and casually to not create the identifier which already exists at any other element. In this case "t-" always means, what is it the identifier of heading of page (from a word title). To tell the truth, the marking becomes slightly superfluous, but it allows to reach{achieve} the greatest flexibility in binding any title images to headings of any pages.
Each replaced heading should be described by several style rules which are characteristic for all other similar headings. In addition to attribute "id", in heading for which it is necessary to change, we use also attribute "class" to which we appropriate{give} value "swap". This class is created for the description of the general{common} properties of substituted headings that allows to set these general{common} properties of all once, not registering their every time in style properties of each identifier id each concrete heading. Besides such approach helps to not list{transfer} in the table of styles all unique identifiers only to appropriate{give} him{it} the same rule, the general{common} for all. Due to this substitution will be applied only to those tegam <h1> which have a class "swap". For not subject replacement tegov <h1> in this case should not write any rules cancelling replacement. Addition of a class - a small victim cleanliness of a marking for the benefit of simplification of the table of styles.
For replacement of headings with the image stopdesign.com uses the following rules:
h1.swap {
height:22px;
background-repeat:no-repeat;
}
h1.swap span {display:none;}
And unique identifiers look so:
h1*t-recentlog {background-image:url ("/img/title_reclog.gif");}
h1*t-articles {background-image:url ("/img/title_articles.gif");}
h1*t-portfolio {background-image:url ("/img/title_port.gif");}
For simplicity of editing and support of a site, all rules for headings of pages are born in a separate file titles.css which is imported in the basic file screen.css. screen.css in turn is connected to html-page with the help of an element <link>.
Example of the second. Pliable bukvicy
Whether it would be desirable you to decorate sometime the first paragraph of the page bukvicej? Till now with shudder recollect increased by means HTML up to five hundred percent{interests} the first letter? What will say, if we use instead of it the image? Certainly, it would not be desirable to lose the first letter in the event that the picture is not loaded. A little having changed the technique described above, we can use for bukvicy practically any font what we shall want. For example, let's address again to old kind Shelley Allegro and we shall create on his{its} basis the letter "E" which will serve bukvicej for the same paragraph.
Us will not arrange bukvica, worth independently at line (so it would turn out if we have concluded her{it} in teg div). We shall agree, that we do not want, that the first letter was somehow allocated on the general{common} background in that case when style rules are inaccessible to a browser. In that case we use a pair universal tegov span:
<p> <span class = "dropcap"> <span> E </span> </span> ver wanted a...
Remember, that we use the background image to external tegu <span>, and internal we use for concealment of the text. In this example we shall set for external tega "buoyancy" (float) that the text of the paragraph covered it{him} on the right and from below. For the best compatibility with various browsers we shall set for the same element property display: block; (however, it should take place automatically at use float). At us such set of style rules will turn out:
span.dropcap {
display:block;
float:left;
width:46px;
height:63px;
margin-right:5px;
background-image:url ("dropcap_e.gif");
background-repeat:no-repeat;
}
span.dropcap span {display:none;}
The width and height for the first rule are taken same, as the corresponding sizes of the image. Besides we have applied a small right space (margin-right) to ours bukvicy. Having united HTML and CSS and having applied some fine style rules to the paragraph, we have received such sample bukvicy.
Still examples
Creative use of a method is limited only to opportunities of our imagination. In this way, among other, it is possible:
* To create trade marks and the names based on use of a font
* "To cast" headings
* To display stock quotes
* To replace separate words with the purpose of improvement of cosmetic effect (for example, replacement "and" i "vs.")
This method can be good at change of appearance of a site with the help of alternative tables of styles. Each table can connect the images.

|