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 CSS Layout Techniques Display Modes Inline-Block Formatting

How to stop text from breaking outside its background?

I'm having issues with display values. I can't tell where I've gone wrong, but my h1 was completely inline with its background. As I followed the instructions through the video, my h1 text has now wrapped to a second line and has also broken outside its background. any ideas why?

thanks

K

Can you post your code? are you displaying inline-block?

How do you post your code? Just copy and Paste?

3 Answers

Yes, you simply past your code but also follow the markdown cheatsheet info. It's in a link at the bottom of the forum. Basically you add three tick marks before and after your code. You also specify what type of language, (html, CSS) by adding the name to the first three tick marks looks like this:

"```html

//paste html code here

Change html to CSS if your posting that. It's mostly for syntex highlighting.

Thanks, man

/*Page Styles*/

body {
  font: normal 1.1em/1.5 sans-serif;
  color: #222;
  background-color: #edeff0;
}

.main-wrapper {
  width: 90%;
  margin: auto;
}


/*Layout Element Colors*/

.main-header       {background-color: #384047; }
.main-logo         {background-color: #5fcf80; }
.main-nav li       {background-color: #3f8abf; }
.primary-content   {background-color: #caebf6; }
.secondary-content {background-color: #bfe3d0; }
.main-footer       {background-color: #b7c0c7; }



/*Header, Banner and Footer Layout*/

.main-header {
  padding: 20px;
}

.main-logo,
.main-nav,
.main-nav li {
  display: inline-block;
}

.main-logo, 
.main-nav li {
  border-radius: 5px;
}

.main-logo {
  margin-top: 0;
  margin-bottom: 0;
  margin-right: 50px;
}

.main-nav li {
  margin-top: 15px;
  margin-right: 10px;
}

.main-logo a, 
.main-nav a {
  color: white;
  text-decoration: none;
  display: block;
  text-align: center;
  padding: 10px 20px;
}

.main-nav li {
  list-style: none;
}

I tried your code out on my PC and can't find an issue with it. What exactly is the problem your having with it?