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
Johan Rönkkö
28,054 PointsFlexbox not working, whats wrong??
My flexbox isnt working correctly, whats wrong? My nav are vertical instead of horizontal even though the flox property should make it horizontal?
html:
<header class="header">
<h1>Abstract</h1>
<nav>
<ul>
<a href="#" class="selected"><li>Portfolio</li></a>
<a href="#"><li>About</li></a>
<a href="#"><li>Contact</li></a>
</ul>
</nav>
</header>
css:
.header {
-webkit-display: flex;
display: flex;
-webkit-flex-direction: row;
}
h1 {
font-size: 3em;
}
nav li {
padding: 5px 10px;
border: 1px solid black;
border-radius: 30%;
}
nav a {
text-align: center;
color: inherit;
font-size: 2em;
}
1 Answer
huckleberry
14,636 Pointsfirst, put 3 back ticks before the css letters in order to format that code.
```css
all your css goes here and then close it with 3 more backticks like below
```
As it stands right now, you're targeting a an element with the class name of header in your css. In your html I don't see anything that has that class name and I also don't see any header tags. If you don't actually have a header tag I would recommend that you do wrap all that stuff in a header tag but that class name that you're targeting (.header) would have to be the class name of the nav element. Try changing the class name to .main_nav or something more semantic and putting that class name in the ul element in order to make your li's flex items.
Huck -
Robert Richey
Courses Plus Student 16,352 PointsRobert Richey
Courses Plus Student 16,352 PointsHi Johan,
I added markdown to help make the code more readable. If you're curious about how to add markdown like this on your own, checkout this thread on posting code to the forum . Also, there is a link at the bottom called Markdown Cheatsheet that gives a brief overview of how to add markdown to your posts.
Cheers!