Solved

CSS styles - how to??

Posted on 2000-03-06
4
271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

726 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