Solved

CSS styles - how to??

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
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 embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

679 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