IF JS needs to go, why not the CSS too?

Posted on 2006-04-13
Last Modified: 2010-04-27
Many search engine optimization specialists say to kill all the Javascript code at the top of the page, and put it at the bottom - it helps search engines index the pages (I am not thoroughly convinced of this, but .. )

So on most of my pages, the CSS is actually LONGER than the JS routines.  If we are trying to "pamper" the search engines so they wont get bent out of shape, how about all that voluminous CSS?  Should it be moved to the end of the document, or does it all have to be included in an include file, which is a pain to edit in a separate file?  If it goes at the end, how can this be done, it is supposed to be at the beginning?

How much do you have to pamper search engines, with CSS and JS?
Question by:scrathcyboy
    LVL 5

    Accepted Solution

    Why do you feel it's difficult to manage sep. CSS JS files?   I find it far more convenient to hold them outside in their own areas than to try to worry about where the CSS is in a project.  It also reduces site publishing time, and improves site performance depending on how the server caching is set up.

    My rule is 70k, but others say 100k.   If your page is >100k, you've got problems with some SE spiders skipping parts of your content.  I always put Javascript in .js files unless I have one very specific function for that file (such as a form validatation that is unique to a certain form, etc.)   CSS is usually more generic and applicable to more than one page.

    I think it will pay great dividends for you to begin putting your CSS definitions in different files and coming up with a naming convention to make referring to said CSS easy.  This way you not only reduce the work involved in managing CSS, but you are probably going to make it a little easier on the spiders.

    In SEO, of course, there aren't too many improvements that are "home runs"... everything is incremental.  So count this as one of them.  A little improvement that you can add to the others.

    Best of luck,

    LVL 44

    Author Comment

    Problem I have is in uploading, sure I can edit CSS and JS file separate, but then I have to manually add each one to the upload sequence, it is royal pain in the neck.  But as you say, if it is worth it, then it is worth it, period.  For first time ever, my index.html on latest site is 101K, biggest size I have ever done.

    But I find the amalgamation of CSS styles is impossible without having one monster CSS.  Each site I do its 100% different from last, all custom tailored to the "feel" and theme of the site.  One CSS is impossible.

    BTW< yours is very good contribution, hits at heart of issue.  Tell me how important it is to get rid of CSS data at front, for search engine ease of indexing?
    LVL 5

    Assisted Solution

    The tools I use notice the dependency on the external CSS, and if it's changed, upload it without any added work from me, so it's not an issue.  It's not an all or nothing thing ... I usually have 3-4 CSS files for large sites.  The CSS link-in (and .JS) sequence will be from generic to specific at the top.  It's a style thing, though.  We all have our own method.  Mine comes from the old days of C/C++ include directives when I used to write lots of code.

    btw, here are the estimated will-index sizes for major engines

    MSN 150k
    Google 101K
    Yahoo 240K appx
    Ask 101K appx

    LVL 44

    Author Comment

    Well I bit bullet and did what you said, now index page is 97K, will be 100K with meta tags.  I think you have answered the question, and as promised in my previous one, I will up points and thank you for your help in forcing me to get these two big baggages into separate files.  On big sites, I will do it in the future.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    With a software solution, you always get to control email signatures and have the final say on the design - not an unrelated department or the uninterested end user.
    Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
    Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
    This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now