I've recently been trying to learn more about CSS. I find it great and all but is there a way to have variables?
For example: Say I have 1,000 pages all with the same <title>, can I make it a variable in my stylesheet so that if ever I decide to change the title I don't have to do it 1,000 times?
Same for like a page header, say I want my name on the top left corner of the page, and I don't know, something else on the right hand corner, can I do that via CSS?
If not, what would be the best way of doing it?
Thank you.
Edit: I also havnt figured out how to add styles to <br>, can that be done?
<title> and headers?
I'm still just testing thigs out, so I went to validator.w3c.org and "checked" this file...
<!DOCTYPE HTML SYSTEM> <head> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <h1>This header is 36 pt</h1> <h2>This header is blue</h2> <p>This paragraph has a left margin of 50 pixels</p> <br><br> <a href = "testcss.html"> testcss </a> </body> </html>
This is the stylesheet for it:
body {background-color: white; font-family:'arial';} h1 {font-size: 36pt} h2 {color: blue} p {margin-left: 50px; font-style:italic; color:green} a:link {color: blue} a:visited {color: purple} a:hover {color: red} a:active {color: purple}
So it's really simple stuff but I'm getting this error:
Line 4, column 7: end tag for "HEAD" which is not finished </head> Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p> Another possibility is that you used an element (e.g. 'ul') which requires a child element (e.g. 'li') that you did not include. Hence the parent element is "not finished", not complete.
:? :?
Thanks again
<title> and headers?
You're getting the error because you haven't included a < title > tag in the head of your document. As far as I know, there is no way to set the title in a css document. This has to be done with html in your base doc. Since you don't have a title, you're getting a validation error.
<title> and headers?
You could do it with php includes. But why would you want to? Each title should be unique to it's page.
<title> and headers?
I guess I have to go study some php as well.
Thank you all, it's just what I was looking for.
<title> and headers?
<!DOCTYPE HTML SYSTEM>
Don't forget a real doctype