css question...

Discussion in 'CSS' started by tptnyc, Mar 10, 2008.

  1. #1
    What is the default coding for any css file which normally comes on the top or before the start of any css file? Which is the basic stand default coding, so that one can change the font, colors etc? - I mean before even you write body{

    body {

    For Example, I have often seen coding like this:

    boxText { font-family: Verdana, Arial, sans-serif; font-size: 10px; }
    .MYboxText { font-family: Verdana, Arial, sans-serif; font-size: 10px;background-color:#F6B597; background-image:url(../../images/block.jpg); background-repeat:repeat-x; width:185px; height:136px;
    margin-top:0px; margin-bottom:0px; }
    .errorBox { font-family : Verdana, Arial, sans-serif; font-size : 10px; background: #ffffff; font-weight: bold; }
    .stockWarning { font-family : Verdana, Arial, sans-serif; font-size : 10px; color: #cc0033; }
    .productsNotifications { background: #f2fff7; }
    .orderEdit { font-family : Verdana, Arial, sans-serif; font-size : 10px; color: #70d250; text-decoration: underline; }
     
    tptnyc, Mar 10, 2008 IP
  2. Spider-Man

    Spider-Man Banned

    Messages:
    2,684
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Uhh...the first thing in a stylesheet usually is:
    
    body {
    (css commands here in correct format, such as, background-color:#ffffff)
    }
    Code (markup):
    Can you show me a link to an example that you're having issues with? It'll be easier to give a solution that way.

    Cheers
     
    Spider-Man, Mar 10, 2008 IP
  3. dzdrazil

    dzdrazil Peon

    Messages:
    64
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    @charset "utf-8";
    /* CSS Document */

    is the most common opening for css files i've seen
     
    dzdrazil, Mar 10, 2008 IP
  4. Spider-Man

    Spider-Man Banned

    Messages:
    2,684
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi, it's late and I'm half asleep, but I *think* this may solve your issue.

    Put this in the html file, in the <head> part.
    
    	<script language="JavaScript" type="text/javascript"><!--
    if  ((navigator.appName == "Microsoft Internet Explorer") && (navigator.userAgent.indexOf ("Opera") == -1))  {
    	document.write ('<link href="style_ie.css" rel="stylesheet" type="text/css" media="screen" />');
    };
    //--></script>
    
    Code (markup):
    Create a file called style_ie.css, and within that file, rewrite your current style sheet, eliminating anything that you think may be the root cause of the problem using the 'clear:' attribute. I am running both Firefox 2 and IE7 and it renders almost identical in both, so don't know what the problem is in IE6. Perhaps you could describe the issue?

    Thanks
     
    Spider-Man, Mar 10, 2008 IP
  5. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Netscape Navigator? Why would anyone put code in their file that references a decade-old browser almost nobody uses?

    The stuff people post at the top is usually the author's preference. Sometimes they like to have all their link colours set or whatever.

    This is a common one:

    
    * {
      margin: 0;
      padding: 0;
    }
    img {
      border: 0;
    }
    ul, li {
      list-style: none;
    }
    
    body {
    body stuff...}
    rest of page...
    
    Code (markup):
    The above is for someone who wants to set all browsers' margins and paddings to zero, have no border on images by default (as almost all browsers put a border around images), and removes bullets from lists (obviously, don't use this if you like bullets in your lists).

    If you want to follow Spider-Man's example, which is trying to use Javascript to detect the user's browser and feed the appropriate css-stylesheet, use a better way (though I'd say don't have a seperate sheet for IE cause you don't need it anyway). People like me surf without Javascript enabled. So now what?
    What if I'm surfing with Opera or Safari? Which stylesheet do I get?

    But you can have ie conditional comments in the <head> if you want, pointing only IE to your IE-specific sheet (if you feel you need that).
     
    Stomme poes, Mar 11, 2008 IP