Converting HTML to CSS

K

Kass

I have a page designed in FrontPage. I want to use it as a template to
design all the other pages in the web site. I also would like to be able to
use that template as a master page, so when I make changes the format of that
page all the other pages in my web will follow suit. Like, if I added a
picture to the master page, the picture would show up in all the other pages.
I understand you can link from your site pages to a CSS page, but I'm not
versed in CSS language. Is there a way to take my FrontPage HTML designed
page and convert it to CSS language?

Kass
 
J

Jens Peter Karlsen [FP MVP]

No, you can't convert HTML to CSS.
look into Dynamic Web Pages in FP2003.

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
M

Murray

HTML is for CONTENT. CSS is for PRESENTATION. The two do not interconvert.

To change a site from using HTML for presentation to one using CSS for
presentation would require a thorough understanding of both HTML and CSS.
The conversion is not a linear process, in that the method you would use,
and the final markup, might be very different on different pages.

If you want to do this (and it's a good thing to want to do, in my opinion),
you will need to do some homework.
 
J

Jim Carlock

Hi there, Kass.

HTML are predefined tags for laying out a page. For instance, you create
tables, paragraphs and such using the predefined HTML tags...

<table width="500" border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td width="10"> </td>
<td width="480"><p>10 pixel side demonstration</p></td>
<td width="10"> </td></tr></tbody></table>

CSS provides _YOU_ with a way to define how the tags are interpreted by
the browser. _YOU_ can change the how the browser interprets those tags.

One important concept that you'll need to know, involves the concept of
"block" level elements and "inline" elements. www.w3schools.com provides
a really good description of it all. You'll find the concepts of "block" and
"inline" everywhere inside of CSS. The way I think of it, is that "block"
identifies elements that carry both a height and width and generally is thought
to start a new line, while "inline" means the HTML tag falls in line with the rest
of the line and does NOT start on a newline.

For instance, you'd use the bold tags to highlight an item on a line...

<p>Here is <b>bold</b>. Here is <i>italic</i>. Here is <b><i>bold
and italic</i></b>.</p>

The paragraph tags ("<p></p>") are "block" tags. The bold and italic tags
("<b><i></i></b>") are "inline" tags.

Using CSS, you can configure how the tags are displayed.

I disagree with what Murray said. He said, "HTML is for CONTENT.
CSS is for PRESENTATION. The two do not interconvert." It needs
a little more explaining because it can be confusing the way it's stated
there.

The problem with that statement is that content IS text, pictures and objects.
HTML does the <i>presentation</i> of the <b>content</b> and provides
a way to <i>change</i> the content. You don't need HTML to present
a picture, text but it might be needed for the creation of objects. For
example, you can view any picture on the web <b>without</b> HTML. You
can view any text file on the web <b>without</b> HTML. HTML does
the presentation and...

CSS provides a way to <i>change</i> the presentation, ie change the
default properties of the HTML tags, as well as, create your own HTML
tags. For instance, you can create your own bi tag for bold and italic:

<html>
<head>
<style type="text/css"><!-- //hide from older browsers
// CSS
bi {
display: inline;
font-weight: bold;
font-style: italic;
}
// --></style>
</head>
<body><p>Here is <bi>bold and italic</bi>.</p></body>
<html>

Hope that helps.

--
Jim Carlock
Please post replies to newsgroup.

I have a page designed in FrontPage. I want to use it as a template to
design all the other pages in the web site. I also would like to be able to
use that template as a master page, so when I make changes the format of that
page all the other pages in my web will follow suit. Like, if I added a
picture to the master page, the picture would show up in all the other pages.
I understand you can link from your site pages to a CSS page, but I'm not
versed in CSS language. Is there a way to take my FrontPage HTML designed
page and convert it to CSS language?

Kass
 
J

Jim Carlock

I mis-stated something myself. The code I gave for creating your own
tag nees to use the <span> tag specifying a class, and something funny
seems to occur when using the HTML comment tags inside of the <style>
tags in the header.

The code should read:

<html>
<head>
<style type="text/css">
..bi {display: inline;font-weight: bold;font-style: italic;}
</style>
</head>
<body><p>Here is <span class="bi">bold and italic</span>.</p></body>
<html>

The class="bi" needs to be used inside of the <span> tag to make it compatible
with most if not all browsers. And the class is represented in CSS by putting a
preceding period in front of the class name, as shown above.

--
Jim Carlock
Please post replies to newsgroup.

Jim:

Thanks for the clarifications and elaborations.
 
M

Murray

I didn't look that closely - here is the corrected markup -

<html>
<head>
<style type="text/css">
<!-- hide from older browsers
/* CSS */
bi {
font-weight: bold;
font-style: italic;
}
-->
</style>
</head>
<body><p>Here is <bi>bold and italic</bi>.</p></body>
<html>

The comments are plain HTML comments, and a CSS (or C) comment thrown in
too.

The bi class does not need to be display:inline since <span> is inline
anyhow.
 
J

Jim Carlock

LOL We're striking out today Murray.

I just sent your version to 5 browsers. None of them displayed the code
you posted below properly. The browsers I tested with were:

FireFox 0.91
Internet Explorer 6.0.2900.2180.xpsp_sp2_rtm.040803-2158
Amaya 8.7
Amaya 9.0
Mozilla 1.7

Thanks for the correction on the "display:inline;". That's definitely not needed
for a <span> tag.

But here's the final coding... <g>

<html><head>
<style type="text/css">
/* CSS */
..bi {font-weight: bold;font-style: italic;}
</style>
</head>
<body><p>Here is <span class="bi">bold and italic</span>.</p></body>
<html>



--
Jim Carlock
Please post replies to newsgroup.

I didn't look that closely - here is the corrected markup -

<html>
<head>
<style type="text/css">
<!-- hide from older browsers
/* CSS */
bi {
font-weight: bold;
font-style: italic;
}
-->
</style>
</head>
<body><p>Here is <bi>bold and italic</bi>.</p></body>
<html>

The comments are plain HTML comments, and a CSS (or C) comment thrown in
too.

The bi class does not need to be display:inline since <span> is inline
anyhow.
 
M

Murray

Curious, indeed. The CSS I posted validates and works exactly as desired in
IE6/SP2. FF1/PC and Mac, Safari1.2.4, and IE5.2.3.

HTML comments immediately after the <style> tag and before the closing
</style> tag are completely normal.

You can see how it works on my site -

http://www.great-web-sights.com, where I have this in the head -

<style type="text/css">
<!--
a.button1 {
background: url("newimages/button.gif") #FFF no-repeat;
background-position: 1px 2px;
}

..mainlist {
line-height: 1.3;
color: #036;
}
-->
</style>
 
J

Jim Carlock

It's this line right here... if CSS parsing encounters an error it seems
to stop parsing. In this case, CSS is looking at the words:
"hide from older browsers" and it doesn't make any sense to the CSS
parser. So you're correct with only "<!--". The older browsers should
ignore a section in the header "<head></head>" if it doesn't understand
it. It's not doing any presentation at that point, except for the <title>
which usually gets put into the title-bar.

<!-- hide from older browsers

It works great for Mozilla and FireFox but fails for IE and Amaya when
I take out the "hide from older browsers" and just leave "<!--" in there.

If you want to leave that "hide" text in there, you'll need C-style comments.

<!-- /* hide from older browsers */

--
Jim Carlock
Please post replies to newsgroup.

Curious, indeed. The CSS I posted validates and works exactly as desired in
IE6/SP2. FF1/PC and Mac, Safari1.2.4, and IE5.2.3.

HTML comments immediately after the <style> tag and before the closing
</style> tag are completely normal.

You can see how it works on my site -

http://www.great-web-sights.com, where I have this in the head -

<style type="text/css">
<!--
a.button1 {
background: url("newimages/button.gif") #FFF no-repeat;
background-position: 1px 2px;
}

..mainlist {
line-height: 1.3;
color: #036;
}
-->
</style>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top