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 trialmichel rodrigues
11,727 Pointsh1 issue, may I knwo why my h1 is under the header and why?
My problem is that the h1 inside the banner (part of it) is under my header and i have to set margin. I would like to be more semantic with my code and I don't want that. because when I remove the position:fixed; everything is ok but I want my header fixed haha. thank you guys! maybe I can't see the answer !!
I Have this Html:
<html>
<head>
<title>Grid Layout</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/grid.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header class="main-header">
<div class="grid-container">
<h1 class="grid-2 main-logo"><a href="#">Logo</a></h1>
<ul class="grid-8 main-nav">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
</ul>
</div>
</header>
<div class="main-banner hide-mobile">
<h1>This is the Main Banner Heading</h1>
<p>Andouille pork chop pancetta drumstick ground round beef ribs swine brisket ham.</p>
</div>
</body>
</html>
this is my css:
/* Page Styles
================================ */
* {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
background-color: #edeff0;
color: black;
}
/* Main Layout Styles
================================ */
.main-header{
padding-top: 10px;
padding-bottom: 10px;
background-color: #384047;
position: fixed;
top: 0;
background:#384047;
width: 100%;
}
.main-nav{
text-align: right;
}
.main-nav a,
.main-logo a{
display: block;
text-align: center;
border-radius: 5px;
color: white;
text-decoration: none;
padding: 10px 20px;
}
.main-logo a {
background-color: #5fcf80;
}
.main-nav a {
background-color: #3f8abf;
}
.main-logo{
margin-top: 0;
margin-bottom: 0;
font-size: 1.5em;
}
.main-nav li{
display: inline-block;
border-radius: 5px;
margin-top: 30px;
}
.main-banner {
background: #dfe2e4;
text-align: center;
padding: 50px 15px;
margin-top: 50px;
}
this is a grid:
/* Global
================================ */
.grid-container {
padding-left: 10px;
padding-right: 10px;
margin-left: auto;
margin-right: auto;
}
img {
width: 100%;
}
/* Media Queries
================================ */
@media (min-width: 1px) and (max-width: 767px) {
.grid-container > [class^="grid-"] {
padding-top: 5px;
padding-bottom: 5px;
}
.hide-mobile {
display: none;
}
}
@media (min-width: 768px) {
/* Columns
================================ */
.grid-container > [class^="grid-"] {
float: left;
min-height: 1px;
padding-left: 10px;
padding-right: 10px;
margin-left: 2%;
}
.grid-container > [class^="grid-"]:first-child {
margin-left: 0;
}
.grid-container > [class^="grid-"]:last-child {
float: right;
}
/* Columns are 65px wide, with 20px gutters
=========================================== */
.grid-1 {
width: 6.5%;
}
.grid-2 {
width: 15%;
}
.grid-3 {
width: 23.5%;
}
.grid-4 {
width: 32%;
}
.grid-5 {
width: 40.5%;
}
.grid-6 {
width: 49%;
}
.grid-7 {
width: 57.5%;
}
.grid-8 {
width: 66%;
}
.grid-9 {
width: 74.5%;
}
.grid-10 {
width: 83%;
}
.grid-11 {
width: 91.5%;
}
.grid-12 {
width: 100%;
}
/* Clearfix
================================ */
.grid-container:after,
.group:after {
content: " ";
display: table;
clear: both;
}
}
@media (min-width: 1200px) {
.grid-container {
max-width: 1100px;
}
}
1 Answer
student
4,341 PointsYou might want to give your body a margin-top?