Solved

CSS styles - how to??

Posted on 2000-03-06
4
258 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
need to fire confirm() popup window in IE using VBA 2 22
Hide un-named HTML Label with CSS 14 36
Character counter breaks after adding EmojiOne Area 4 23
Html Newline 7 21
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.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

829 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