SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    0 Post(s)
    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
    West Springfield, Massachusetts
    198 Post(s)
    3 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;}
    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
    Join Date
    Jan 2005
    0 Post(s)
    0 Thread(s)

    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
    Sarasota, FL
    0 Post(s)
    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.

    <html xmlns="" xml:lang="en" lang="en">
    		<style type="text/css" media="all">
    			body {
    				color: black;
    				margin: 10px;
    				background-color: #CCCCCC;
    			a:link { 
    				color: red;
    			a:visited { 
    				color: green;
    	<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>
    Chris Bloom
    Web Application Developer


Posting Permissions

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