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

Jason Nelson
Jason Nelson
6,209 Points

Putting my H1 and Nav bar in the same line.

I'm trying to place my H1 and nav on the same line. I'm also attempting to wrap my text around the placeholder instead of under the image. Can anyone help me out? Thanks

https://codepen.io/EhondaGod/pen/yQQpxg?editors=1100#0

1 Answer

Christine Hendrickson
seal-mask
.a{fill-rule:evenodd;}techdegree
Christine Hendrickson
Front End Web Development Techdegree Student 5,422 Points

Hi Jason!

For the <h1> and navigation, you'll want to put them within a <header></header> tag. Then float them both:

header {
width: 100%;
}
h1 {
float: left;
}
nav {
float: right;
}

I'm not sure what you mean when you say you'd like to wrap the text around the "placeholder" - are you trying to display the text beside the image? Or actually wrap it around the image? You can use the same float technique on the text or image, if you just want it to the side.

To move the text to the side, place the <p> content in a <div> tag and assign it a class.

Here's an example that I used with your code to fix the text to the right of the image:

#floated {
  width: 700px;
  padding-top: 20px;
  margin-right: 20px;
  float: right;
}

Looks like there are some other options for you as well, if you want to wrap the text around the image - maybe using CSS shapes will help. CSS Shapes Module 1

Also, if you want to take a look at the adjustments I made to your code, you can see it here:

Code Review for Jason (Treehouse)

I hope that helps! Happy Coding ☺