more basic html questions

topic posted Sat, December 15, 2007 - 8:26 AM by  timOthy
Share/Save/Bookmark
Advertisement
I would like toknopw where what code do I use for making my background and main images load first on a page
posted by:
timOthy
Jacksonville
Advertisement
Advertisement
  • Re: more basic html questions

    Tue, April 1, 2008 - 4:55 PM


    Sounds like your talking about preloading... www.htmlgoodies.com/tutorial...p/3480001

    Preloading will cache the you background and main images so that users can navigate without have to load each image over and over again.

    If you not talking about preloading, than one thing to note is that the browser is going to read the page from top to bottom.

    Hope that helps
    • Re: more basic html questions

      Tue, April 8, 2008 - 2:40 AM
      if you place everything in a stylesheet and the stylesheet is linked from the top of the page in the header where it should be, then the stuff in the stylesheet will load before the rest of the page- because once the browser gets to the line of code where the stylesheet is, it will load the stylesheet before it contiues on with the rest of the code. if your background image isn't very big, this is a good thing. if you have some huge thing that you want to place back there, it could lag, in which case, you might want to reconsider the big huge background if that may be the case that may be.
      • Unsu...
         

        Re: more basic html questions

        Tue, April 8, 2008 - 8:56 AM
        Which brings up a good point. I know that *I* have never got to this point (my site style info is usually pretty small and simple) but....

        What is the way for detecting that your stylesheet is too bulky and you should span your CSS into 2 or more style sheets instead of having the page load one huge one? If you do have to use 2 or more style sheets, where should each style sheet reference be placed within the body?

        Kat
        • Re: more basic html questions

          Tue, April 8, 2008 - 10:40 AM
          Style sheet should ALWAYS be in the head of the document. Scripts however... canbe placed at the end of the body depending on thier function.

          Breaking your stylesheets up doesnt really save you anything you still have to load the same amount of data. Its better to break them up for logical things... for examle my css directory usually looks like this:

          css/
            lib/
             grid.css
             typography.css
             forms.css
             ie.css
             reset.css
            modules/
             modulename/
             modulename.css
             lib/
              node.css
              ie.css
           global.css
           main.css
           print.css

          then depedning on the page requested i dynamically write my link statements. modulename and main sheets are just "collectors" they hold only a series of @import declarations for other sheets. so basically when everything is said and done this what a list of sytlesheets looks like for a page in order of loading:

          (imported by main.css)
          css/lib/reset.css
          css/lib/typography.css
          css/lib/grid.css
          css/lib/forms.css
          css/global.css
          (imported by modulename.css)
          css/modulename/lib/node.css
          (only if ie sheets are needed)
          css/lib/ie.css
          css/modulename/lib/ie.css

          • Unsu...
             

            Re: more basic html questions

            Tue, April 8, 2008 - 11:45 AM
            But you would agree that a site loading could be slowed down by a rather large stylesheet file, right?
            • Re: more basic html questions

              Tue, April 8, 2008 - 12:15 PM
              it potentially could be... but splitting them up is not going to make much of a difference.. because all of them still have to load and the body isnt goign to load untl the head where the stylesheets are is done.

              REally the only thing you can do short of serverside gzip compression is to make your CSS as concise as possible and use the cascade so you arent defining the same thing in seven places... On top of that you can do what i do and "minify" them... mean instead of easy to read css you basically remove all the whitespace (except in properties of course).
              • Unsu...
                 

                Re: more basic html questions

                Tue, April 8, 2008 - 12:20 PM
                Im not sure I understood the cascading you are talking about. Did you mean your folder structure of all the seperate css files?
                • Re: more basic html questions

                  Tue, April 8, 2008 - 1:34 PM
                  No.. i mean using the CSS cascade effectively. CSS opperates like a hierarchy with more specific riles overiding more general ones. This can allow you to keep your code fairl compact because you can define broadly how thing should look say on an h2. and then depending on other factors you can redefine only what needs to be changed for that particular instance instead of redefining every little thing. This allows you to use inheritence/cascade to your advantage. You probably do this but most likely not anywhere near as efficiently as you could be using it - and that can probably be said for 95% of us.
                  • This is the maximum depth. Additional responses will not be threaded.
                    Unsu...
                     

                    Re: more basic html questions

                    Tue, April 8, 2008 - 4:13 PM
                    Okay. I do admit that the last CSS sheet I worked with had so many classes and tags. It wasnt very organized, at least compared to your diagram and it was probably still pretty simple in all comparison. It only looked complicated to me. :)

Recent topics in "HTML Coding"

Topic Author Replies Last Post
Favicon Replacement Jim 1 November 27, 2009
Im in the wrong tribe Hjiørst 1 October 12, 2009
New to XHTML Sierra 5 March 10, 2009
Form not working Ariana 2 February 25, 2009