Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Accessing external css file  (Read 3949 times)

0 Members and 1 Guest are viewing this topic.

shouvik

    Topic Starter


    Apprentice

  • Computer Hope - Always For Your Help
    Accessing external css file
    « on: December 30, 2008, 09:06:58 PM »
    My html document on the page is:-

    <HTML>
    <HEAD>
    <TITLE>HOW DO YOU DO THAT</TITLE>
    <link href="creating.css" rel="stylesheet" type="text/css">

    <body>
    <span class="headlines">Welcome</span>


    <div class="sublines">
    This is the paragraph
    </div>

    <table border="2"><tr><td class="sublines">
    This is the second paragraph
    </td></tr></table>


    <div class="infotext">
    This is the footer
    </div>
    </body>
    </html>[/color]


    The external css file (creating.css) is:-

    body {
    .headlines, .sublines, infotext {font-face:arial; font-weight:bold;}
    .headlines {font-size:14pt; COLOR:RED; background:yellow;}
    .sublines {font-size:12pt; COLOR:GREEN; background:red;}
    .infotext {font-size: 10pt; COLOR:BLUE; background:yellow;}
    }



    The page is showing properly in internet explorer,
    but not in firefox or opera.

    i.e. in these two browsers i am not getting any color
    or font size that i have mentioned in the CSS file.

    What have I done wrong?

    xenium007



      Rookie
      Re: Accessing external css file
      « Reply #1 on: December 31, 2008, 03:44:43 AM »
      Some codes always does not do same thing different browser. it would be better to visit the url of w3c. Hope it make u transparent.

      copy this URL: http://w3c.org
      ::x::e::n::i::u::m::

      kpac

      • Web moderator
      • Moderator


      • Hacker

      • kpac®
      • Thanked: 184
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 7
      Re: Accessing external css file
      « Reply #2 on: December 31, 2008, 05:52:29 AM »
      You have the CSS file formatted wrong. You cannot place element classes inside the body class.

      Try this:

      Code: [Select]
      .headlines, .sublines, .infotext
      {
      font-face:arial;
      font-weight:bold;
      }

      .headlines
      {
      font-size:14pt;
      COLOR:RED;
      background:yellow;
      }

      .sublines
      {
      font-size:12pt;
      COLOR:GREEN;
      background:red;
      }

      .infotext
      {
      font-size: 10pt;
      COLOR:BLUE;
      background:yellow;
      }

      shouvik

        Topic Starter


        Apprentice

      • Computer Hope - Always For Your Help
        Re: Accessing external css file
        « Reply #3 on: January 01, 2009, 11:52:52 PM »
        You have the CSS file formatted wrong. You cannot place element classes inside the body class.

        Try this:

        Code: [Select]
        .headlines, .sublines, .infotext
        {
        font-face:arial;
        font-weight:bold;
        }

        .headlines
        {
        font-size:14pt;
        COLOR:RED;
        background:yellow;
        }

        .sublines
        {
        font-size:12pt;
        COLOR:GREEN;
        background:red;
        }

        .infotext
        {
        font-size: 10pt;
        COLOR:BLUE;
        background:yellow;
        }


        It worked. ;)

        kpac

        • Web moderator
        • Moderator


        • Hacker

        • kpac®
        • Thanked: 184
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 7
        Re: Accessing external css file
        « Reply #4 on: January 02, 2009, 05:13:42 AM »
        Good. :)