That'll do it, there's a few improvements obviously, but that's the basics. And I use
'em' as the measurement, you may want to use other units, like 'px' .
EDIT: What they're describing above is a way of associating groups of styles, or classes, with elements on a web page. You can implement that in a few ways, here's one which may suit you:
In your HTML page, containing the
<p> tagged content from your DB add in a new 'style' node and wrap the styles you want to declare in a class like so:
So above, all
<p> elements in your document will have that style rule applied. Perhaps you are pumping your paragraph content into a container of some sort? Try this:
In the example above, only the
<p> element inside the div, whose class name is 'container', will have the styles applied - and not the <p> element outside the container.
In addition to the above, you can collect your styles together and remove the style element from the
<head> tag, replacing it with a <link> tag, which points to an external CSS file. This external file is where you'd now put your <p> tag styles. This concept is known as 'seperating content from style' and is considered good practice, and is also an extendible way to create styles, and can help with low maintenance. |
Aucun commentaire