Using CSS
-
Hi there, I am developing a website and I am quite new to using CSS. I already have a lot of HTML to change/update that I think someone generated using word or frontpage. I want to apply styles to the standard heading tags h1 etc.. Can I do this but leave all the old etc tags in the html file or do I have to remove them(There are hundreds). I was trying to work out if there is an order of precedence for the tags, but I can't seem to work it out. sorry if this is a stupid question.
-
Hi there, I am developing a website and I am quite new to using CSS. I already have a lot of HTML to change/update that I think someone generated using word or frontpage. I want to apply styles to the standard heading tags h1 etc.. Can I do this but leave all the old etc tags in the html file or do I have to remove them(There are hundreds). I was trying to work out if there is an order of precedence for the tags, but I can't seem to work it out. sorry if this is a stupid question.
Andy, It sounds like you should start by doing a copy and paste of the HTML tags into notepad. Do this and save it as HTML, and see how your HTML behaves with your CSS Additions. Not knowing what your HTML code looks like I would try this and see how it turns out. I'm sure you'll get more good suggestions from the other members here, there is a lot of good folks here that have loads of experience with HTML, and programming. Tony
-
Hi there, I am developing a website and I am quite new to using CSS. I already have a lot of HTML to change/update that I think someone generated using word or frontpage. I want to apply styles to the standard heading tags h1 etc.. Can I do this but leave all the old etc tags in the html file or do I have to remove them(There are hundreds). I was trying to work out if there is an order of precedence for the tags, but I can't seem to work it out. sorry if this is a stupid question.
I believe that if you have explicit styles coded into the HTML they will override to styles you specify in your css file - I don't know for sure because I try always to use one or the other method, but never both at the same time. If you have multiple css files linked into the page, the last one linked takes precedence over previous styles if there is any overlap in their contents. Probably the easiest way to learn it is to play with it. Create a simple test page with several elements in it but no styles specified. Give each section or element a class name. Then create a couple of css files with the same classes defined, but different styles associated with each, and link them into your html page HEAD section. View the results before and after changing the order in which they are linked in the page, then add some explicit style attributes in the HTML itself and see what effect that has. An hour or two of playing with it will probably answer a bunch of questions.
"The Lion shall lie down with the Lamb;
but the Lamb will not get much sleep..."
Lazarus Long -
I believe that if you have explicit styles coded into the HTML they will override to styles you specify in your css file - I don't know for sure because I try always to use one or the other method, but never both at the same time. If you have multiple css files linked into the page, the last one linked takes precedence over previous styles if there is any overlap in their contents. Probably the easiest way to learn it is to play with it. Create a simple test page with several elements in it but no styles specified. Give each section or element a class name. Then create a couple of css files with the same classes defined, but different styles associated with each, and link them into your html page HEAD section. View the results before and after changing the order in which they are linked in the page, then add some explicit style attributes in the HTML itself and see what effect that has. An hour or two of playing with it will probably answer a bunch of questions.
"The Lion shall lie down with the Lamb;
but the Lamb will not get much sleep..."
Lazarus LongHi again, I had a play around with it, and it looks like the style sheets get overridden by the html tags already present. i.e. if I do something like
this is a title
and the style sheet is set up for h1 without underline I still get underlined text. So I've taken to just commenting out the tags for the moment. One thing I would like to know though, is how is it possible to make pages that use CSS compatible with older browsers, if it isn't possible to have a set of default HTML tags in the document when no CSS support is available or have I completely missed the point? thanks andy
-
Hi again, I had a play around with it, and it looks like the style sheets get overridden by the html tags already present. i.e. if I do something like
this is a title
and the style sheet is set up for h1 without underline I still get underlined text. So I've taken to just commenting out the tags for the moment. One thing I would like to know though, is how is it possible to make pages that use CSS compatible with older browsers, if it isn't possible to have a set of default HTML tags in the document when no CSS support is available or have I completely missed the point? thanks andy
andyg.101 wrote: how is it possible to make pages that use CSS compatible with older browsers You can't. Older browsers don't support modern CSS. For them you have to encode the styles in your HTML and pray that they will work.
"The Lion shall lie down with the Lamb;
but the Lamb will not get much sleep..."
Lazarus Long -
Hi there, I am developing a website and I am quite new to using CSS. I already have a lot of HTML to change/update that I think someone generated using word or frontpage. I want to apply styles to the standard heading tags h1 etc.. Can I do this but leave all the old etc tags in the html file or do I have to remove them(There are hundreds). I was trying to work out if there is an order of precedence for the tags, but I can't seem to work it out. sorry if this is a stupid question.
I had problems with HTML genereted by WORD or Front Page... Therefore I have created a class that cleans all the unwanted tags... I can send it to you if you want ... theJazzyBrain Wise is he who asks good questions, not he who gives good answers
-
Hi again, I had a play around with it, and it looks like the style sheets get overridden by the html tags already present. i.e. if I do something like
this is a title
and the style sheet is set up for h1 without underline I still get underlined text. So I've taken to just commenting out the tags for the moment. One thing I would like to know though, is how is it possible to make pages that use CSS compatible with older browsers, if it isn't possible to have a set of default HTML tags in the document when no CSS support is available or have I completely missed the point? thanks andy
andyg.101 wrote: how is it possible to make pages that use CSS compatible with older browsers You may not want to bother. Most people use modern browsers, only a hand full in comparison use browsers that do not understand basic CSS. If you wish to support those few, then you have two choices, don't use CSS or keep two versions of your site. Rocky Moore <><
-
I had problems with HTML genereted by WORD or Front Page... Therefore I have created a class that cleans all the unwanted tags... I can send it to you if you want ... theJazzyBrain Wise is he who asks good questions, not he who gives good answers
-
if you give me an email address I can send it to you... Just to let you know that it a C# class. theJazzyBrain Wise is he who asks good questions, not he who gives good answers