Jump to content

object conformity


brookwood

Recommended Posts

Hi, I'm relatively new to website design. I'm not sure if this question should be posted in CSS or HTML or where. What I'm wondering is this, essentially CSS is used in order to centralize the style of objects on a site, so one change can affect all pages that reference it, and code can be shortened, correct? Well, is there a way to centralize code for an object? For instance I have a table with certain aspects of it (like heading, menu, etc) that I want to use in multiple pages of a site. As far as I know, I have to copy and paste the code for this table into each page and then if I want to change it, I have to go to each page and change them individually. So can this be avoided? Thanks for any help.

Link to comment
Share on other sites

Say you've got:<table id="mytable"><tr><td>some text</td></tr></table>You can set the style of "mytable" through CSS using:#mytable { width: 100%; height: 100%; padding: 4px.. . etc etc }Upload the style sheet and use a <link rel= .. to put it on the page. Then you just need to change the styling in that one file to alter all instances of "mytable" on your site :)

Link to comment
Share on other sites

Thanks for the response. I'm actually looking to be able to change the object itself, not the style. By which I mean its layout of rows and cells, the menu that I put in a cell, the logo that I put in another, etc. I was hoping to find a way to have all of this centralized so that if I decide I want a different menu or a different layout, etc I can just change the one instance and not have to go back through all the pages. Is this possible?

Link to comment
Share on other sites

Yes, but you'd have to use PHP then, or IFRAME the content if you don't have a PHP host. For instance.. umm:

<table><tr><td> <iframe src="home.html" frameborder="no"></td></tr></table>

Would be your index.html page.All your content would be loaded through the iframe in the main cell, so changing the content of your index.html page would change the look of most of your site (although, you'd have to make minor changes to the colors of the "home" and other pages etc).If you'd like an example of what i'm trying to get at: http://www.sc-photos.co.uk/other/exile . The text in the middle is an IFRAME, but the bits around it is all part of the index.htm file.PHP would be the ideal option, but iframes aren't too bad :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...