Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS How to Make a Website CSS: Cascading Style Sheets Center the Wrapper

John Hughes
John Hughes
2,015 Points

How do I increase space between the first image and the header? My wrapper background is only showing on the left side

Wrapper background does not extend above the first image.

Wayne Priestley
Wayne Priestley
19,579 Points

Hi John,

Could you please post your html and css so we can take a look and help you out.

Here is a link to explain how to use Markdown to post your code How to post code

If you look at the bottom of the box when your typing a reply you will see Markdown Cheatsheet that will also explain how to post your code.

Hope this helps.

2 Answers

John Hughes
John Hughes
2,015 Points

Thanks Wayne, I still don't understand how to post my html and css. Can you explain further?

Wayne Priestley
Wayne Priestley
19,579 Points

You have to make sure you have a bit of space under your last line of text in your post. Then you add three back ticks followed by html or css depending on the type of code your inserting.
Then straight after your last line of code you add another three back ticks.
Remember to leave at least a few lines between any text at the top or bottom of your code.

alt text

Hope this helps.

Jarrod Brooks
Jarrod Brooks
5,071 Points

//Moved to a Comment, rather than an answer.

Just look at the How-to-guide as Wayne Priestley had suggested, and look for "Inline Code and Block Code". Or look at this quick explanation on that page

Basically surround your code in 3 back-ticks. on most keyboards this is the "`" character to the left of the "1" key. Back tick.

you are going to want syntax highlighting

  1. type the first 3 backticks, then without any space type html.
  2. hit the return/enter key to go to the next line
  3. past the code you want us to see
  4. hit the return/enter key to go to the next line
  5. then close it with 3 more back ticks
  6. hit the return/enter key to go to the next line
  7. If the CSS is all inline/wrapped in "style" tags then just paste it all in the html code snippet. If not do the same thing for the css if needed.
  8. Then hit the preview (eyeball) icon on the bottom right of the text box to check it.

It should turn out like this

<!-- example in the html -->   
<body>
  <style>
        header {
        margin-bottom: 20px; 
        } 
        div.wrapper {
        background: #000000 url("smiley.gif") no-repeat fixed center;
        }
  </style>  
  <header>...</header>
  <div class="wrapper">...</div>
</body> 
/* or seperated */
header {
margin-bottom: 20px; 
}
div.wrapper {
background: #000000 url("smiley.gif") no-repeat fixed center;
}

Hope this helps :smile:

John Hughes
John Hughes
2,015 Points

thanks I've posted my code

Jarrod Brooks
Jarrod Brooks
5,071 Points

where did you post it? I am not seeing it on this thread.