SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    adding css to an already existing site

    I have finally decided to add css code to my existing site. My site has about 2,000 pages. I just bought Dreamweaver 8 and I have set up my external css document. Now I just need to insert the link to my external css on all my pages.

    This is probably a dumb question, but I am new at css. Do I need to take out all of my old html style formatting after I insert the css? If not what happens? Do I need to remove the old page properties? What about inline tags etc. Please help, I have alot of pages to do.

    Do I need to take the previous formatting out of all of my pages? Example:
    <body topmargin=0 bgcolor="#FFFFFF" text="#000000" link="#5F4480" vlink="#AB9BD9" alink="#E8C539">

    I am only going to use css for formating text and links to start out while I am learning.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,264
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    rewriting 2000 pages

    Hi riospace, welcome to the forums,
    2000 pages
    AFAIK CSS styles that are inline have priorty over in-head CSS that has priority over external CSS. In other words if my external CSS file has
    body {background-color: #f00;}
    and the page's head has
    <style type="text/css">
    body {background-color: #0f0;}
    </style>
    and the body tag is
    <body style="background-color: #00f;">
    the background color will be #00f
    You may be able to use "important" in the external CSS file to force the style, but I don't know how that would work as I've never tried it.
    Are the pages hard coded static HTML or generated server-side? If the are HTML pages that you've written over a period of time you have to put in the link to the external file anyway, so this could be a lengthy process. There may be a way to create a template and pull the content from the existing pages to put into it. It may be worth your time to try to find a way to automate the rewriting process before you dive headlong into doing it yourself. This should be possible if the pages are well-formed. Maybe write a script that parses the content out of the existing pages into a database?

  3. #3
    Non-Member
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    4,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    As far as I know DW 8 can convert inline CSS to sheet css ? , maybe by an extension ?

  4. #4
    SitePoint Zealot
    Join Date
    May 2003
    Location
    Sarasota, FL
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mittineague is correct about the order of inheritance in CSS. However, if your question was whether you need to remove any attribute-based styling (vlink, alink, font tag, etc) then the answer is no, so long as your style sheet overrides those styles.

    Code:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    	<head>
    		<title>Test</title>
    		<style type="text/css" media="all">
    			body {
    				color: black;
    				margin: 10px;
    				background-color: #CCCCCC;
    			}
    			a:link { 
    				color: red;
    			}
    			a:visited { 
    				color: green;
    			}
    		</style>
    	</head>
    	<body topmargin="0" bgcolor="#FFFFFF" text="#000000" link="#5F4480" vlink="#AB9BD9" alink="#E8C539"> 
    		<p><a href="#1" class="">Go</a></p>
    		<p><a href="#2" class="">Stop</a></p>
    		
    		<p><font color="#0B0000">Blue</font></p>
    	</body>
    </html>
    Chris Bloom
    Web Application Developer


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •