Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CSS styles - how to??

Posted on 2000-03-06
4
Medium Priority
?
286 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 87 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

618 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