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

Author Topic: html and css  (Read 6647 times)

0 Members and 1 Guest are viewing this topic.

nymph4

    Topic Starter


    Specialist

    html and css
    « on: April 06, 2010, 08:26:16 AM »
    I like HTML and I think it is  an ok code to use.
    But I know CSS  lets you do more and have more controle over the page.

    I don't like useing the Inline  css  because you have a lot of DiV  Tags all over with  css code in it  so if you change something you have to find the Div Tags with the code.

    I like Internal  css because everything goes in the Head Tags.

    and I have one page  but how slow will the page load if everything is in the Head Tags??????????????????????

    To me Inlije  css is just like  HTML  everyware there is tet in the page you ad more Div tage or  more  HTML for the font.

    So this is why I like Internal  css  but I wont use it if it will  keep my page loading slow???????

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: html and css
    « Reply #1 on: April 06, 2010, 11:01:41 AM »
    It's better to keep all your CSS in a separate file. This way, instead of having it in the <head>, the browser can download the CSS file and store it in the cache.

    soybean



      Genius
    • The first soybean ever to learn the computer.
    • Thanked: 469
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 10
    Re: html and css
    « Reply #2 on: April 06, 2010, 01:34:14 PM »
    And, if you have many pages, changes to your styles will be easier to make if they all in a separate CSS file.  You only need to make the changes in that one file, not in all pages.

    nymph4

      Topic Starter


      Specialist

      Re: html and css
      « Reply #3 on: April 06, 2010, 02:02:19 PM »
      ok I think I get how to link the pages to the CSS file.

      and the code will be in that file for say one page.

      But say your second page has diferant font types and things how do you tell  it wen to use this code for this page and this set of code for this page?

      soybean



        Genius
      • The first soybean ever to learn the computer.
      • Thanked: 469
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 10
      Re: html and css
      « Reply #4 on: April 06, 2010, 02:08:56 PM »
      To use styles on individual pages that are not in your CSS file, use inline or embedded styles. They will override the styles in the CSS file.

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: html and css
      « Reply #5 on: April 06, 2010, 02:38:18 PM »
      ok I think I get how to link the pages to the CSS file.

      and the code will be in that file for say one page.

      But say your second page has diferant font types and things how do you tell  it wen to use this code for this page and this set of code for this page?

      You use seperate CSS files...
      I was trying to dereference Null Pointers before it was cool.

      kpac

      • Web moderator
      • Moderator


      • Hacker

      • kpac®
      • Thanked: 184
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 7
      Re: html and css
      « Reply #6 on: April 06, 2010, 02:39:26 PM »
      Quote
      But say your second page has diferant font types and things how do you tell  it wen to use this code for this page and this set of code for this page?
      If you had read the tutorial: http://w3schools.com/css/css_id_class.asp


      Look at any of the forum's page's code
      Code: [Select]
      <link rel="stylesheet" type="text/css" href="http://www.computerhope.com/forum/Themes/classic/style.css?fin11" />Every page on the forum uses this stylesheet, but it is only loaded once by the browser (if caching is enabled).

      soybean



        Genius
      • The first soybean ever to learn the computer.
      • Thanked: 469
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 10
      Re: html and css
      « Reply #7 on: April 06, 2010, 02:47:47 PM »
      You use seperate CSS files...
      Yes, that's another way, in addition to embedded and/or inline styles.

      nymph4

        Topic Starter


        Specialist

        Re: html and css
        « Reply #8 on: April 07, 2010, 03:28:20 PM »
        Ok I understand all about how to link pages to the CSS page that has the code and it loads faster aand things like this.

        But if I use  Inline  CSS code that is just wen I place code off and on all through my page useing  Div  Tags  this will get top  pryarity in browsers  and be the first  code to use.

        Then why use Exturnal  CSS????????

        kpac

        • Web moderator
        • Moderator


        • Hacker

        • kpac®
        • Thanked: 184
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 7
        Re: html and css
        « Reply #9 on: April 07, 2010, 03:34:19 PM »
        Will your pages not use some sort of template?

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: html and css
        « Reply #10 on: April 07, 2010, 03:50:13 PM »
        Then why use Exturnal  CSS????????
        because you can create a single CSS class definition that gets used in a variety of places in your HTML. for example:

        Code: [Select]

        <html>
        <head>
        <style>

        .blueelement {
        background-color:blue;
        opacity:1.0;
        filter:alpha(opacity=100);
        text-decoration:none;
        font-family: "Segoe UI", Tahoma,"MS Sans Serif", Charcoal,Chicago;
        }
        .redelement
        {
        background-color:red;
        opacity:1.0;
        filter:alpha(opacity=100);
        text-decoration:none;
        font-family: "Segoe UI", Tahoma,"MS Sans Serif", Charcoal,Chicago;
        }
        </style>
        </head>
        <body>
        <div class="blueelement">
        This is some text. with a <span class="redelement"> "redelement" </span> inside.
        </div>
        <span class="redelement"> This is a span set to redelement</span>
        </body></html>

        If you had those styles inlined you would need to copy paste the definitions into a "style" attribute for every single element. Whereas using classes (as I do most of the time) you can define it once and simply set the class attribute to point to the style you want.

        Here it doesn't save a whole lot of space but imagine using "bluelement" and "redelement" several dozen times throughout the page. Also, for editing, you need only change the CSS class definitions, every element using that class will change accordingly.
        I was trying to dereference Null Pointers before it was cool.

        kpac

        • Web moderator
        • Moderator


        • Hacker

        • kpac®
        • Thanked: 184
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 7
        Re: html and css
        « Reply #11 on: April 07, 2010, 04:10:19 PM »
        Of course....
        Quote
        If you had read the tutorial: http://w3schools.com/css/css_id_class.asp
        ...we wouldn't have to keep repeating ourselves. ::)

        bobsmithmoodeyit



          Greenhorn

          • Website Design and Computer Repairs
        • Experience: Beginner
        • OS: Windows XP
        Re: html and css
        « Reply #12 on: April 13, 2010, 05:19:36 AM »
        have the CSS Style sheet on its own File. ^_^

        soybean



          Genius
        • The first soybean ever to learn the computer.
        • Thanked: 469
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 10
        Re: html and css
        « Reply #13 on: April 13, 2010, 09:12:33 AM »
        have the CSS Style sheet on its own File. ^_^
        That point has been clearly made already.  ::)

        nymph4

          Topic Starter


          Specialist

          Re: html and css
          « Reply #14 on: April 13, 2010, 10:41:29 AM »
          sorry I have niot replyed all is working good.
          Thanks