Reputation: 599
Brand new to html/css, is there a way to manage recurring elements on a site such as a toolbar? For example, if I have a website with 10 pages and want to change the HTML for the universal toolbar, do I have to change it on all 10 pages?
Upvotes: 4
Views: 3377
Reputation: 386
You have few options:
Use iframe tag:
<iframe src="toolbar.html"></iframe>
Upvotes: -2
Reputation: 512
If you mean having recurring items check out Madara's answer. If you mean recurring styles, the following will give you an example:
If you want a certain text to show up as red every time, you can name it "Red":
In css:
.red{
color: red;
}
The "." indicates its a recurring element and you can name it whatever you want as long as its being used in the html.
In html:
<span class="red">Sample text</span>
Upvotes: 0
Reputation: 174957
The easiest way would be a server-side include.
Meaning, you have:
And in index.php
you looks something like:
<?php include_once "head.php"; ?>
Actual content here
<?php include_once "footer.php"; ?>
head.php
for example, would look like:
<!doctype HTML>
<html>
<head>
<title>Hello</title>
<?php include_once "nav.php"; ?>
</head>
<body>
Upvotes: 7
Reputation: 15112
Depends. If the HTML is written in 10 different places then Yes, you have to change it on all 10 pages. If you're adding the HTML to all pages through a common usercontrol(if you are .net that is) or using a template, then you can do it in 1 place & be done with it.
Upvotes: 0