How to create template whit Css / PDF
0
<font> tags. With the nested
table layouts that have become commonplace on the Web, it would not be uncommon
to see ten or twenty <font> tags simply dedicated to applying the same font to all of the
text on the page. Multiply this by 5
pages for a modest site and you could have around one hundred tags. A bigger site might have 50 pages or more, in
which case you are looking at a thousand <font> tags, all dedicated to applying that one basic, consistent style
to the text of your document.<font>
tags to make what, from your client’s perspective, may seem like a very simple
change. You can pretty much kiss the
weekend you had planned goodbye. Try not
to groan out loud – it doesn’t go over well with most customers.<basefont> tag, which lets you set
the default font to be used throughout a page, provides a nice solution to this
problem. Even then, you’d have to adjust
one tag for each page of your site. Add
another font style to the equation (maybe a different font for the menu bar),
and the problem returns in full.<html><head><title> A simple page </title></head><body><h1><font face=”sans-serif” color=”#3366cc”>First
Title</font></h1><p>...</p><h1><font face=”sans-serif” color=”#3366cc”>Second
Title</font></h1><p>...</p><h1><font face=”sans-serif” color=”#3366cc”>Third
Title</font></h1><p>...</p></body></html>Save the file as css1.html<h1> tags. To make these headings stand out more, we
have used <font>
tags to make them light blue in a sans-serif font (Windows browsers will
display them in Arial, for example).
Notice the repetition involved, even at this basic level. We have had to specify the details of the
font we wanted three separate times.
Wouldn’t it make sense to define the font just once and then apply it to
all the headings? <style> tags in the <head> of the document, where we define our light blue, sans-serif font
and apply it to the <h1> tags in the document. At
this point don’t worry about the syntax; it will be explained in detail as we
go on. <font> tags have completely disappeared from the <body>, leaving our document
looking a lot less cluttered. <style> tag, as we did in the
example above. This lets you declare any
number of CSS styles by placing them between the opening <style> tag and the closing </style> tag, as follows:TYPE attribute specifies the language that you’re using to define your
styles. CSS is the language we are going
to use to define our pages and is indicated with the value text/css. Another language you may come across is
JavaScript Style Sheets (JSS), and is specified by text/javascript. <style> tag has one major disadvantage.
Specifically, if you want to use a particular set of styles throughout
your site, you’ll have to repeat those style definitions in a <style> tag at the top of every
one of your site’s pages..css filename), and then link your documents to that one file. Any changes to the style definitions in that
one file will affect all pages that link to it.
This enables us to design our site with site-wide style definitions, our
original objective.styles.css), place a <link> tag in the document’s
header:<link
rel=”stylesheet” type=”text/css” href=”styles.css”><html><head><title> A simple page </title><link rel=”stylesheet” type=”text/css” href=”styles.css”></head><body><h1>First Title</h1><p>I can place my first subject here.</p><h1>Second Title</h1><p>Information relating to my second heading goes
here.</p><h1>Third Title</h1><p>This is where my third title text will be
placed.</p><BR><a href = “http://www.itn.co.uk”>ITN</a><BR><a href = “http://www.bbc.co.uk”>BBC
Home Page</a></body></html>Save
the file as css3.htmlstyles.css file contains the style
definition below:styles.css file in as many pages as
you need. Not only will it save you
typing, but it also ensures a consistent look to the headings across your
entire site.......h1.important, p.important {color: red;}
<h1 class = "important"> ... </h1>
*.important {color: red;}
In the XHTML document:
<h1 id = "veryImportant"> ... </h1>
In the Style Sheet:
#veryImportant {background: black; color: red;}
h1 em, p strong {color: purple;}
h1 > strong {color: red;}
h1 + p {margin-top: 0;}