It's Sunday ... and I've been teaching Cascading Style Sheets (or rather "I've been teaching a customer about cascading style sheets") ... one of our delegates for this week's
PHP course asked me to spend a few hours going through CSS with him ahead of time.
Here's an example ... using the "KISS" approach (Keep it Simple, Stupid) to avoid the whole thing getting too complex for its own good. I've chosen to post this today to show you just how much
better it is to use classes and
divs than other more complex specifiers on standard HTML elements - for I have only to add in another surrounding tag and my standard classes would fail, but the classes go on working.
The source code:
<html>
<head>
<style>
table table {
align: center;
color: red;
background: blue;
}
table table tr td {
padding-left: 100px;
color: yellow;
background: green;
}
.maths{
padding-left: 100px;
color: green;
background: yellow;
}
</style>
</head>
<body>
Flubber<br />
<table width=100%><tr><td width=100% align=center>
<table border=1>
<tr><th>Say what</th><th>To whom</th></tr>
<tr><td><div align=center class=maths>Hello</div></td>
<td>World</td></tr></table>
</td></tr></table>
<br />
</body>
</html>
How it looks:
And you can see the full source listing on its own page
here and run it for yourself
here(written 2008-06-15 14:56:36)
Associated topics are indexed under
W701 - Web and Intranet - Introduction to Cascading Style SheetsW702 - Web and Intranet - Elements of cascading style sheetsW704 - Web and Intranet - Cascading style sheets - putting it all together
Some other Articles
Adding a button to a web page to print the pageAstroturfing - the online definitionPHP - Sanitised application principles for security and useabilitySoftware - changes and delays. But courses must run on time!CSS training - Cascading Style Sheets (UK course)A warm welcome for visitors from the USAComparing Objects in C++What a lot of files! (C++ / Polymorphism demo)Spam Filters ... are working!The Composting Cone Challenge