SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: simple CSS issue

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simple CSS issue

    Hey, I'm not sure why this is happening, but I'm pretty sure it's a simple fix:

    my site is here:

    www.yourvancouvermortgagebroker.ca

    And I want the background to be:

    #E7E9EB

    But for some reason, (in my chrome editor), it shows that it is linking to a stylesheet that is not the default style.css. Instead it just shows the home page url...

    Thanks

    J

  2. #2
    Non-Member
    Join Date
    Jun 2010
    Location
    47°27′35″N 26°18′0″E
    Posts
    1,789
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have this in html, starting from line 88:
    Code:
    body {
        background-color: #f9f9f9;
        color: #222;
        font-family: Cantarell, Verdana, sans-serif;
        font-size: 12px;
    }
    A quick fix is to make it:
    Code:
    body {
        color: #222;
        font-family: Cantarell, Verdana, sans-serif;
        font-size: 12px;
    }
    But, if you want to make a better web page, loose all the <style> elements in <head>.

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice, thanks. Switching all these themes, sometimes I forget about that stuff.

  4. #4
    Non-Member
    Join Date
    Jun 2010
    Location
    47°27′35″N 26°18′0″E
    Posts
    1,789
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem

  5. #5
    SitePoint Guru team1504's Avatar
    Join Date
    May 2010
    Location
    Okemos, Michigan, USA
    Posts
    727
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    But, if you want to make a better web page, loose all the <style> elements in <head>.
    Really? I have heard many arguments on this. I used to use in head styling and links to stylesheet.

    Then i developed this bad coding habit of inline styling. I know although it is convenient, it is bad practice

    And now i am just using in head styling.

    If you have links to stylesheets, does that increase the numbers of header requests and slow the load speed for your page?

  6. #6
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    19,936
    Mentioned
    216 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by team1504 View Post
    And now i am just using in head styling.

    If you have links to stylesheets, does that increase the numbers of header requests and slow the load speed for your page?
    The main value of CSS is the ability to link to external style sheets, to which every page in the site can link. Repeating styles on each page is hugely inefficient. The only time it's reasonable to place styles in the head is if they will only ever apply to that page alone.

    Normally, once an external stylesheet has been downloaded it gets cached, so it shouldn't have to be requested more than once.

  7. #7
    SitePoint Guru team1504's Avatar
    Join Date
    May 2010
    Location
    Okemos, Michigan, USA
    Posts
    727
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    The main value of CSS is the ability to link to external style sheets, to which every page in the site can link. Repeating styles on each page is hugely inefficient.
    I completely forgot how inefficient that would be.

    But since I am testing and developing, not publishing the projects yet, I agree with noonnope that once I have all the styling and scripts done to link them


    Thanks for the clarification

  8. #8
    Non-Member
    Join Date
    Jun 2010
    Location
    47°27′35″N 26°18′0″E
    Posts
    1,789
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is possible the way examples are often given here, on SP forums, to confuse you, team1504

    But, I, for example, resort to this strategy (put style in the <style> element, in the <head>) only because it's makes for a compact example, quick to test and easy to follow.

    On a final page, style belongs to external stylesheet. And so does any scripting, it has to be placed in an external file and linked.

  9. #9
    SitePoint Zealot materialdesigner's Avatar
    Join Date
    Dec 2010
    Location
    Ithaca, NY
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, for CMSs (like Wordpress) that usually use a header.php for all pages, there is no way of using <style> tags in the head to style just a specific page.

    Everything is put into the external stylesheet, and body class names allow you to style specific pages differently.

  10. #10
    i want cake and cookies Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    9,996
    Mentioned
    41 Post(s)
    Tagged
    1 Thread(s)
    Sometimes when I'm just starting a site, I'll have a single document with <style> tag in the <head>, just because I don't have much code, I'm saving changes to a single document, and it's all roughing-in everything.

    Once I've gotten to the point where I'm actually looking at the results in a browser (so after major boxes are written and styled and after content is filled the boxes mostly), I pull the styles out to an external sheet because then I'm usually starting the next page.

    For one-page demos, the styles in in <style> tags for the reasons noonope mentioned: one document with all th code there to show an example, not to show that's how you'd do it on a production page.

  11. #11
    It's all Geek to me silver trophybronze trophy
    SitePoint Award Recipient ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, Australia
    Posts
    19,936
    Mentioned
    216 Post(s)
    Tagged
    2 Thread(s)
    I purposely didn't mention pages in production, as anything goes there really, and I too use styles in the head for such purposes. Inline CSS etc wouldn't exist if it didn't have a purpose. I figure the real issue is how things are set up on the final site.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •