Click to See Complete Forum and Search --> : Variables in HTML?


VeniVidiVince
09-13-2004, 06:59 AM
In languages such as Java you can define a part of code as a variable.
What about HTML?

Can you define parts as variables to keep your code short and to keep track of the content?

You can swap out CSS-Code with:
<link rel=stylesheet type="text/css" href="style.css">
HTML too?

soccer362001
09-13-2004, 07:02 AM
No you cannot use HTML to create variables. In order to change style sheets you would need to use JS or PHP or something of the sort.

Stephen Philbin
09-13-2004, 07:27 AM
Hyper Text Markup Language.

Charles
09-13-2004, 10:10 AM
There called entities and they exist in both HTML and XHTML&trade;. One wee problem though, In HTML they're not supported by any browser I know and in XHTML&trade; they're only supported by MSIE and even there the file has to have an ".xml" extension. But they're way useful if you are going to pre-process you page before uploading.

When you use "&amp;trade;" you're using an entity. And they can even be used to include external files. They're defined in either the DTD or the DOCTYPE.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [

<!ENTITY giantSays '<p style="color#f00">Fee, fie, foe, fum.</p>'>

]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
&giantSays;
</body>
</html>