Reputation: 1
I made a navbar but I can not make it full width.
I'd like to have it full width and without padding, like this:
#cssmenu {
width: 100%;
font-family: Raleway, sans-serif;
line-height: 1;
border-bottom: 4px solid #1CE678;
}
#cssmenu > ul {
background: #3db2e1;
}
#cssmenu > ul > li {
float: right;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
perspective: 1000px;
}
<div id='cssmenu'>
<ul>
<li><a href='#'>1</a></li>
<li><a href='#'>2</a></li>
<li><a href='#'>3</a></li>
<li><a href='#'>4</a></li>
<li class='active'><a href='#'>5</a></li>
</ul>
</div>
Upvotes: 0
Views: 206
Reputation: 1
Have you tried simply using
<meta name="viewport" content="width=device-width, initial-scale=1.0">
inside of your html head? My personal website navbar file is very similar to yours but I haven't encountered this sort of issue.
Upvotes: 0
Reputation: 121
make you margin padding 0
Html
<div id=cssmenu >
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
Css
body{
margin:0;
}
#cssmenu {
width: 100%;
font-family: Raleway, sans-serif;
line-height: 1;
border-bottom: 4px solid #1CE678;
margin:0;
padding:0;
}
#cssmenu > ul {
background: #3db2e1;
margin:0;
padding:0;
text-align:right;
}
#cssmenu > ul > li {
display:inline-block;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
perspective: 1000px;
}
Upvotes: 1
Reputation: 432
Don't forget to put this on every css files, I hope it will help
* {
box-sizing: border-box;
}
html, body {
padding: 0;
margin: 0;
}
Upvotes: 0
Reputation: 8921
The cause is most likely your <ul>
. Modify your CSS like so:
#cssmenu > ul {
background: #3db2e1;
margin:0;
padding:0;
}
#cssmenu > ul > li {
float: right;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
perspective: 1000px;
margin:0;
padding:0;
}
You'll also want to make sure that the parent element (presumably body
) doesn't have any padding.
body {
padding:0;
margin:0;
}
Upvotes: 0