Quick ways from plain html to CSS and more

They have: 34 posts

Joined: Feb 2002

So I have a site that I recently redesigned and generally like the layout of (eldaronline.com), but unfortunately for me, I want to change it such that there is an external CSS, it will make my life a lot easier in the long run I figure. (I also have to change the alignment to either centered or flexwidth, but that's another story)...

So I want to have absolute control over the font colors, styles, sizes, etc. instead of playing the browser-guessing game which I'm currently dealing with ... my fonts look very different than from what I thought they'd look like - sizes don't seem right, etc.

I know, I made the mortal sin of using Frontpage, but it sure as heck saves a lot of time that way... but now i have to pay for it...

So, My question to you, dearly beloved fellow webmasters =) ... is

WHAT IS A QUICK AND EASY WAY TO CONVERT ALL MY HTML PAGES TO CSS? I mean, to remove all of the tags in there and to have it controlled by an external style sheet? I really don't feel like going through every page and deleting and adding all the tags... there must be a better way! =) Is there a program that will sift through all the pages within a site / folder and just convert everything from html tags to CSS? I heard that GoLive can do something similar to that, is that true?

Please do share your knowledge with me ... and please do let me know the compatibility issues of CSS... do I still need to keep the tags in there such that disagreeable browers see something if they can't read CSS?

******

question #2 ...

I may be switching this site over to PHP ... are there any compatibility issues with PHP and CSS?

question #3 ... PHP and Flash ok?

THANK YOU ALL FOR YOUR HELP! =)

Busy's picture

He has: 6,151 posts

Joined: May 2001

1/ get yourself a good text editor (i use editpad), something that has a search and replace option (editpad allows you to have over 300 pages open in it *and yes I've had over 300 lol*) If your coding is standard - all font tags are the same it shouldn't take to long. the text can be controled by use of the body {...} tag in your css file, if you need bigger/smaller, colored text then you'll need to add class="something" to your td cell, div tag, span tag, or whatever (remember to close whatever tag you use) and add .something {...} into your css file. It may take a while, last year i changed one of my sites over to css (was over 2000 pages) and only took a couple of hours.
not all (under half) of css is fully supported, keep away from things like margins and borders, keep it to fonts, sizes, weights (bold etc), links and backgrounds even.
you can and probably should usea validator service (most are free), like w3c.org to test your layouts, but remember just because it validates doesnt mean it displays the same on all browsers.

2/ no issues with php and css, just remember if you adding different classes (.something {...}) to include the class="something" into your php commands - if any.

3/ php and flash ok, no worries, php is just a method of laying things out, you still use the same html tags, same javascript, css tags, php is just used to bring it all together depending on what is called for where.

They have: 34 posts

Joined: Feb 2002

Thank you for the prompt reply, as I'm sure you're always Busy =)

Well, with regards to text editors, I use frontpage, hence it could actually look through the ENTIRE site and replace strings with other strings...

so that's a good idea...but since i'm a css dummy, i better read up on it before i do some search and replace! =)

The problem is this... I didn't write the code, Frontpage did, and from what I've heard, their code is rather inefficient... do you think this method of search / replace will work?

I'll definitely give it a try though

w3c.org ... i'll give that a try... no clue what it is, but i'm finding out soon...

Thank you again!

And if anyone has any more to add to this, please do!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I don't have an url for this, but search for HTML Tidy -- that will clean up a lot of the gunk from FP.

Smiling S

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

You can also look for programs that will do search/replace in documents that aren't open. This is handy, because you can just pick your directory, set your search/replace options and go from there. No getting messy with 300 open files Wink

Macromedia's homesite does this - it also happens to be the most post powerful HTML editor on the market. I highly recommend it. If you're not interested in that then do a search at your favourite download site for search/replace programs - there are stand-alones that will do this too.

Once you've stripped out all the font tags and such, you can create an external stylesheet and use the search/replace again to stick the reference into the HEAD of every page.

Getting consistent font sizing is difficult even with CSS. The best way to do it is to define your sizes in pixels (rather than points or ems etc.)

They have: 34 posts

Joined: Feb 2002

OK, let me get this straight... if I put the CSS line in all my pages, do I still need to remove the font tags? or does the css override everything?

And using CSS is not as simple as just adding that one line, right? I still have to add lines like before all the titles and whatnot, correct?

If so, then this indeed is a lot of work! =)

Macromedia's homesite? I better go get it then...

Thanks for the help everyone, and again if you anybody has any more tips, I'm always here to listen, er read

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

not quite.

you only need classes for unique circumstances.

your basic CSS just states what each tag should look like:

h1 {font-size: xxpx;}
p {}
body {}

If you don't remove the font tags, and you use no DOCTYPE or HTML Transitional 4.01 or lower DOCTYPE, then the CSS will NOT override those tags unless you declare it in the CSS.

font {}

You should, ideally, remove the font tags. You'll also have to tidy up the content to make sure all tags are closed.

Suzanne

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

And when you use classes, it looks like this in the CSS sheet:

.class {...}

And like this in the HTML

They have: 34 posts

Joined: Feb 2002

Thanks everyone!

Now, I have many many urls to decent guides to teach me CSS... but in your opinion, what is the best site to learn CSS from? one that will teach me to get rid of what i need to teach me what I need to put in?

OK, it don't have to be the best, but as long as it works! =)

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

LOL....I feel your pain Raine. gee that rhymes;)

I just recently converted one of my clients sites. I am still not finished building all of his pages but I am glad that I swapped over to css when I did. I did approx. 35 pages. It wasn't that bad. I had to go through almost every little inch of code to make sure that there were no font tags left. That was the biggest thing. After you get a "system" going though you will breeze right through your pages. And the rewards will be great when you finish. Smiling

mmi's picture

They have: 457 posts

Joined: Jan 2001

hey - the first point I wanna make is that I think yer making a mistake if you think HTML is complicated - it can be, but only in fairly narrow or advanced areas - mmy guess is that you're already familiar with the basic structure of a document and that's about half the game - don't be intimidated by it - it's not like scripting/programming - to me, that's like comparing checkers with chess

if you have a large number of pages, I guess the automated search-and-replace approach could be a real good idea to strip out stuff you don't want - but as DM notes, these pages will still require careful attention

Quote: And using CSS is not as simple as just adding that one line, right? I still have to add lines like before all the titles and whatnot, correct?

well, I guess you may need to go into each document and paste in CLASS attributes - depends on how you've used elements so far, I suppose


Web Xpertz Community Forums for Webmasters & Developers

Where You Can Learn, Advise, and Have Fun in the Process

Busy's picture

He has: 6,151 posts

Joined: May 2001

I had to edit 2000+ pages with different font tags (as mentioned before), since it was an old site it had a lot of mismatched font tags, like:
and and and ....

but since all (98%) of the font tags were the same result I just used the search and replace on every combination I found starting at the top, then once I thought I had them all, i then searched for "... seperatly.

Took a few hours, was very boring (music helps pass the time) but now with help of an external style sheet all fonts are controled by one tag: body {...}.

As for a good site, I dont think there is one, but dont settle for one site to learn CSS, a lot of sites out there teach bad habits and messy code that doesnt work on all browsers. do a search for css and follow a few sites finding out what works and what doesnt, dont worry to much which version they teach, css2 is the normal one but they are up to 3, which IMO is still in beta.
could also do a search in here for css.

good luck

detox's picture

They have: 571 posts

Joined: Feb 2001

There used to be a great CSS site around that had a name something like css recipe book or something like that. I cant remember sorry!

Just to add my two cents worth as well though, you should think about having some kind of browser check with javascript at the head of your page to direct different browsers to different external files. You might have to then edit 2-3 css files but that is a heck of a lot easier than editing 30-50-100.....2000 pages worth of tags!

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I learned css at http://www.webmonkey.com - a good tutorial there. http://www.w3schools.com is another good one.

They have: 34 posts

Joined: Feb 2002

Thanks again everyone, this is becoming a great learning experience for me! I will read up on those two as Megan has pointed out, and will also do any other research I need to do...

this bites... 200 pages... ah well, it's gotta be done to save me a headache later on! =)

mmi's picture

They have: 457 posts

Joined: Jan 2001

hey - don't forget the blooberry patch

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.