Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

mukul lohia
mukul lohia
985 Points

background color is not changing

<!DOCTYPE html> <html> <head> <meta charset="utf-8">

<title>MUKUL LOHIA|ENTREPRENEUR</title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href"css/main.css">

</head>

<body> <header> <a href="untitled.html" <h1>MUKUL LOHIA </h1> <h2>ENTREPRENEUR</h2> </a> <nav> <ol> <li><a href="untitled.html">portfolio</a></li> <li><a href="about.html">about</a></li> <li><a href="contact.html">contact</a></li></ol></nav> </header>

<section> <ul> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>natural is good</p> </a>

      </li>
       <li>
          <a href="img/numbers-02.jpg">
          <img src="img/numbers-02.jpg" alt="">
       <p>natural is good</p>
                </a>

      </li>
       <li>
          <a href="img/numbers-06.jpg">
          <img src="img/numbers-06.jpg" alt="">
       <p>natural is good</p>
                </a>

      </li>
       <li>
          <a href="img/numbers-09.jpg">
          <img src="img/numbers-09.jpg" alt="">
       <p>natural is good</p>
                </a>

      </li>
       <li>
          <a href="img/numbers-12.jpg">
          <img src="img/numbers-12.jpg" alt="">
       <p>natural is good</p>
                </a>

      </li>

    </ul>
</section>

<footer> <p>© 2016mukul lohia.</p>

</footer> </body>

</html> pls tell me how can i change my background color

3 Answers

Hi, here are a few examples along with descriptions.

body{
    background-color: ######;
}

As stated, stylesheets are most common when it comes for editing your look and feel to a website. I love using this method due to it's space saving ability in documents. Rather than taking up space you can just have everything neatly put together. I personally use this method for my full website styles.

Inline Styles

<!DOCTYPE html>
<html>
  <body>
     <style>
        body{
            background-color: ######;
        } 
     </style>

  </body>
</html>

<style></style> tags are really useful for quick page stylesheets. Definitely not recommended but I personally use these if I have a user account that wants a certain colour scheme on their profile page.

Element Styles

<body id="id" style="background-color: ######;"></body>

These are used to add styles directly in the element tag. I personally use these for quick styling that doesn't need to be included in the main stylesheet.

Extra Learning

If you want to learn a bit more about CSS3 then try and using either the Treehouse CSS3 course which you should learn if your on the Web Development track. Or if you want to catch a gist of CSS3 go to http://www.w3schools.com/css/css3_intro.asp

Althought I highly recommend continuing with Treehouse and learning the CSS3 they do a great job at explaining.

Ash Scott
Ash Scott
423 Points

I answered this issue in another post :)

You have an = symbol missing in your css import:

<link rel="stylesheet" href"css/main.css">
<link rel="stylesheet" href="css/main.css">

Second one is the correct one :D

mukul lohia
mukul lohia
985 Points

thanx for clearing my doubt..