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.

Design

Jane Marianne Filipiak
Jane Marianne Filipiak
7,444 Points

Unintended overlapping background images

Good day everyone!

I have been designing a web-page which has elements from what I have learned from Nick and Guil. I have tried to stop the background image (url splodge.jpg) from displaying twice, and overlapping, but I cannot find why it is doing that. Here is the code for the index.html page, and then the main.css page.

Any advice is much appreciated.

Jane

`` <!DOCTYPE html> <html> <head> <meta charset="utf"> <title>Jane Filipiak | Designer</title> <link rel="stylesheet" href="css/normalize.css"> <link href='http://fonts.googleapis.com/css?family=Dosis:400,600,700|Syncopate:400,700|Open+Sans:400italic,600italic,400,600' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/main.css"> </head> <body> <header id="top" class="main-header"> <img src="img/splodge.jpg" alt="brushmark"> <a href="index.html" class="logo"> <h1>Jane Filipiak</h1> <h2>Designer</h2> </a>

<nav>
  <ul>
    <li><a href="index.html" class="selected">Portfolio<a/></li>
    <li><a href="about.html">About</a></li>
    <li><a href="contact.html">Contact</a></li>
  </ul>
</nav>

</header> <div id="wrapper"> <section> <ol> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>Experimentation with color and texture.</p> </a> </li> <li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt=""> <p>Playing with Blending Modes in Photoshop.</p> </a> </li> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>Experimentation with color and texture.</p> </a> </li> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>Experimentation with color and texture.</p> </a> </li> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>Experimentation with color and texture.</p> </a> </li> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> <p>Experimentation with color and texture.</p> </a> </li> </ol> </section>
<footer>

        <a href="http://twitter.com/jamari_filipiak">
            <img src="img/twitter-wrap.png" alt="Twitter Logo" class="social-icon">
        </a>
    <p>&copy; 2015 Jane Filipiak.</p>
        <a href="#top">Back to top &raquo;</a>
        </footer>
    </div>

</body> </html>

`` /-----------------BASE STYLES------------------/

  • { box-sizing: border-box; }

body { max-width: 100%; margin: 0 auto; font-family: 'Open Sans', sans-serif; background-color: Cornsilk; color: Teal; }

a { text-decoration: none; }

p, ol { color: Teal; }

/--------------LOGO------------------/

.main-header { background-color: Azure; background-image: url('../img/splodge.jpg'); background-size: cover; background-repeat: no-repeat; background-position: center; }

h1 { font-family: 'syncopate', sans-serif; color: #EE82EE; text-align: center; padding: 20px 0 5px; font-size: 2.5em; font-weight: bold; line-height: 0.8em; }

h2 { font-family: 'syncopate', sans-serif; color: #48D1CC; text-align: center; font-size: 2em; margin: 5px 0 0; font-weight: normal; }

/----------------NAVIGATION-----------------/

nav { text-align: center; padding: 10px 0 0; margin: 20px 0 0; }

nav ul { list-style: none; }

nav li { display: inline-block; }

nav a { font-family: 'dosis', sans-serif; font-size: 1.5em; font-weight: 800; }

/-----------------NAV COLORS-------------------/

nav { background-color: #5F9EA0; }

nav a { color: #afeeee; }

nav a:visited { color: Thistle; }

nav a.selected { color: #EE82EE; }

nav a:hover { color: #DB7093; }

/---------------CONTENT-------------------/

wrapper {

max-width: 100%;
margin: 0 auto;
padding: 0 5%;
background: Linen;

}

/----------------FOOTER-----------------/

footer { font-size: 0.75em; text-align: center; padding-top: 50px; }

.social-icon { width: 20px; height: 20px; margin: 0 5px; }

``

3 Answers

Ryan Parcell
Ryan Parcell
12,625 Points

Hi Jane. I believe you're running into difficulty because you have listed the splodge.jpg element twice. Once in your html file: <img src="img/splodge.jpg" alt="brushmark"> and once in your css: background-image: url('../img/splodge.jpg'). Both elements are adding the image to the page. Try removing one or the other by commenting them out at first to troubleshoot.

Jane Marianne Filipiak
Jane Marianne Filipiak
7,444 Points

Many thanks Ryan. I commented out splodge.jpg in the html page and now it displays perfectly. I still have to figure out why! Have a great day!

Ryan Parcell
Ryan Parcell
12,625 Points

The background- image element specifying the URL in your css document inserts a second picture element into the html document. To add style to your image try adding an ID tag in the html and using #id to reference it in the css.