Solved

CSS styles - how to??

Posted on 2000-03-06
4
244 Views
Last Modified: 2011-09-20
I'd like to know how to apply CSS styles to a tag such as "TD" with a few conditions. EG - How to make the stylesheet overide any other size settings that may be in place. Also if the browser is incompatible with stylesheets to enable the html fontsizes to exist also????
0
Comment
Question by:grchris
4 Comments
 
LVL 4

Expert Comment

by:ruperts
ID: 2590736
There are a couple of reference site which I use, but I'm not sure if you can override the <FONT> statement using CSS.

http://msdn.microsoft.com/workshop/author/css/reference/attributes.asp#ie40_cssref

http://builder.cnet.com/Authoring/CSS/table.html

0
 
LVL 32

Accepted Solution

by:
Batalf earned 29 total points
ID: 2590750
You could define the style in the header of your html-document(between <HEAD> and </HEAD>
ex :
<HEAD>
   <STYLE TYPE="text/css">
      TD.normal {font-style : italic;
          font-family: "comic sans ms", helvetica, sans-serif; }
</HEAD>

In your HTML-document, you refer to this style, ex :
<P CLASS="normal">This is a test</P>

You could put in !important in your stylesheet to make it override other settings.

<HEAD>
   <STYLE TYPE="text/css">
      TD.normal {font-style : italic;
          font-family: "comic sans ms", helvetica, sans-serif; !Important}
</HEAD>

You could also put your styles into an own css-file(ex : styles.css). Then you have a file containing this :

      TD.normal {font-style : italic;
          font-family: "comic sans ms", helvetica, sans-serif; }

and other styles.

You make a lookup in the header of your html-doc to this file :

<link rel="STYLESHEET" href="Styles.CSS" MEDIA="screen" type="text/css">

Your Html-doc will then get the styles from the file styles.css



Regards
Batalf

0
 
LVL 1

Expert Comment

by:technoman
ID: 2590755
create a style sheet first

<STYLE>
 <!--
      TD.ITEM      {
              vertical-align: top;
              background-color: #FFFBF0;
            }

      TD.COUNTER     {
                   padding: 0mm;
                   background-color: #0000FF;
                   font-family:"Courier New";
                   font-size:11pt;
                                       font-weight: bold;
                   color:#00FF00;
                    }
-->
</STYLE>

and in HTML file


<TABLE>
 <TR>
  <TD CLASS=ITEM></TD>
  <TD CLASS=COUNTER></TD>
 </TR>

You just have to specify the style to apply to the tag, and that will overide the default style for that tag.

as for the conditions, let say netscape and ie, unless you have a program in the serverside to send the right style sheet to the user.  
0
 

Author Comment

by:grchris
ID: 2594160
Batalf? thanks for the answer, ermm can css style sheets contain code?
 EG. If netscape then
 something
else if ie then
something else
end if

Otherwise I suppose I could set a session variable to pick what stylesheet to use on each page....
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now