My nav bar (which is at the top of the page) and header (below nav, which has a large image and a text on top of it), have a very small gap between them that I want to remove. I've visited a number of posts on similar problems, and tried their solutions, but can't seem to work for me, including: display: block; margin: 0; e.t.c.
I guess it has something to do with a style I have applied on either the header's content or the nav's content.
body {
margin: 0px;
padding: 0px;
background-color: #f2f2f2;
}
html {
margin: 0px;
padding: 0px;
}
#logo {
height: 50px;
width: auto;
float: left;
}
nav ul {
list-style-type: none;
overflow: hidden;
margin: 0;
padding: 0;
background-color: #1a1a1a;
text-align: center;
border: 1px solid #e7e7e7;
display: inline-block;
width: 100%;
}
nav li {
display: inline-block;
}
nav a {
display: inline-block;
padding: 16px 15px;
text-decoration: none;
font-family: arial;
font-weight: bold;
color: white;
}
nav a:hover {
background-color: orange;
color: white;
}
nav {
margin-bottom: 0;
}
header {
margin-top: 0;
margin-bottom: 10px;
width: 100%;
font-family: arial;
font-size: 18px;
color: orange;
}
h1 {
position: absolute;
top: 150px;
width: 100%;
z-index: 1;
text-align: center;
}
#bannerImage {
width: 100%;
height: auto;
position: relative;
z-index: 0;
}
<nav>
<ul>
<img id="logo" src="https://67.media.tumblr.com/f607af5bc60d1b2837add83c70a2aa45/tumblr_inline_mrwv19q8fE1qz4rgp.gif"/>
<li>Game 2</li><li>Game 3</li>
</ul>
</nav>
<header>
<img id="bannerImage" src="http://static2.hypable.com/wp-content/uploads/2014/09/Hogwarts-lake.png"/>
<h1>Games</h1>
</header>
Just define the height of nav
body {
margin: 0px;
padding: 0px;
background-color: #f2f2f2;
}
html {
margin: 0px;
padding: 0px;
}
#logo {
height: 50px;
width: auto;
float: left;
}
nav ul {
list-style-type: none;
overflow: hidden!important;
margin: 0;
padding: 0;
background-color: #1a1a1a;
text-align: center;
border: 1px solid #e7e7e7;
display: inline-block;
width: 100%;
}
nav li {
display: inline-block;
}
nav a {
display: inline-block;
padding: 16px 15px;
text-decoration: none;
font-family: arial;
font-weight: bold;
color: white;
}
nav a:hover {
background-color: orange;
color: white;
}
nav {
margin-bottom: 0;
height: 51px;
}
header {
margin-top: 0;
margin-bottom: 10px;
width: 100%;
font-family: arial;
font-size: 18px;
color: orange;
}
h1 {
position: absolute;
top: 150px;
width: 100%;
z-index: 1;
text-align: center;
}
#bannerImage {
width: 100%;
height: auto;
position: relative;
z-index: 0;
}
<nav>
<ul>
<img id="logo" src="https://67.media.tumblr.com/f607af5bc60d1b2837add83c70a2aa45/tumblr_inline_mrwv19q8fE1qz4rgp.gif"/>
<li>Game 2</li><li>Game 3</li>
</ul>
</nav>
<header>
<img id="bannerImage" src="http://static2.hypable.com/wp-content/uploads/2014/09/Hogwarts-lake.png"/>
<h1>Games</h1>
</header>
The problem is caused by your ul having overflow:hidden so just remove it.
Added box-sizing:border-box to avoid horizontal scrollbar
UPDATE
I noticed that you have an img as child of ul which makes that invalid HTML.
So I tweaked your code to make it valid.
*,
*::before,
*::after {
box-sizing: border-box
}
body,
html {
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
#logo {
height: 50px;
width: auto;
display: inline-block;
vertical-align:top
}
nav {
margin-bottom: 0;
background-color: #1a1a1a;
border: 1px solid #e7e7e7;
}
nav ul {
list-style-type: none;
width: calc(100% - 60px);
margin:0;
padding: 0;
text-align: center;
display: inline-block;
vertical-align: top;
}
nav li {
display: inline-block;
}
nav a {
display: inline-block;
padding: 16px 15px;
text-decoration: none;
font-family: arial;
font-weight: bold;
color: white;
}
nav a:hover {
background-color: orange;
color: white;
}
header {
margin-top: 0;
margin-bottom: 10px;
width: 100%;
font-family: arial;
font-size: 18px;
color: orange;
}
h1 {
position: absolute;
top: 150px;
width: 100%;
z-index: 1;
text-align: center;
}
#bannerImage {
width: 100%;
height: auto;
position: relative;
z-index: 0;
}
<nav>
<img id="logo" src="https://67.media.tumblr.com/f607af5bc60d1b2837add83c70a2aa45/tumblr_inline_mrwv19q8fE1qz4rgp.gif" />
<ul>
<li>Game 1
</li>
<li>Game 2
</li>
<li>Game 3
</li>
</ul>
</nav>
<header>
<img id="bannerImage" src="http://static2.hypable.com/wp-content/uploads/2014/09/Hogwarts-lake.png" />
<h1>Games</h1>
</header>
Try setting the height of the nav:
nav {
height: 50px;
}
Tried it out and works even without the margin set to 0.
Related
My logo and navigation float to the left and right respectively when the screen gets to 40rem. However it overlaps with the next div which contains a background image. I tried setting margins but that just moved both logo/nav and the image lower on the page.
#import url('https://fonts.googleapis.com/css?family=Raleway:300,400,700,900');
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Raleway', sans-serif;
text-align: center;
}
img {
max-width: 100%;
height: auto;
width: auto;
}
.container {
width: 95%;
max-width: 70em;
margin: 0 auto;
}
.clearfix::after,
section::after {
content: '';
display: block;
clear: both;
}
/* typography
================= */
.unstyled-list {
margin: 0;
padding: 0;
list-style-type: none;
}
/* header
================= */
header {
position: relative;
left: 0;
right: 0;
margin: 1em;
}
.logo {
width: 200px;
height: 40px;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin: 1em;
padding: 0.125em;
}
nav a {
font-weight: 900;
text-decoration: none;
text-transform: uppercase;
font-size: .8rem;
padding: .75em;
color: #DDD;
}
/* home-main
================= */
.home-main {
background-image: url('../manjitcss/img/manjit-main.png');
background-size: cover;
background-position: center;
padding: 10em 0;
}
#media(min-width:40rem) {
.logo {
float: left;
margin-top: .5em;
}
nav {
float: right;
}
}
#media(min-width:60rem) {
.logo {
width: 250px;
height: 50px;
}
nav {
margin-top: .5em;
}
nav a {
font-size: 1.04em;
}
}
<header>
<img src="../manjitcss/img/logo.jpg" alt="Foo logo" class="logo">
<nav>
<ul>
<li>Home</li>
<li>About Me</li>
<li>Contact</li>
</ul>
</nav>
</header>
<section class="home-main">
<div class="container">
</div>
</section>
You have .clearfix in your css, but you have not applied them to header whose contents you are floating.
Add the class to header - see demo below:
#import url('https://fonts.googleapis.com/css?family=Raleway:300,400,700,900');
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Raleway', sans-serif;
text-align: center;
}
img {
max-width: 100%;
height: auto;
width: auto;
}
.container {
width: 95%;
max-width: 70em;
margin: 0 auto;
}
.clearfix::after,
section::after {
content: '';
display: block;
clear: both;
}
/* typography
================= */
.unstyled-list {
margin: 0;
padding: 0;
list-style-type: none;
}
/* header
================= */
header {
position: relative;
left: 0;
right: 0;
margin: 1em;
}
.logo {
width: 200px;
height: 40px;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin: 1em;
padding: 0.125em;
}
nav a {
font-weight: 900;
text-decoration: none;
text-transform: uppercase;
font-size: .8rem;
padding: .75em;
color: #DDD;
}
/* home-main
================= */
.home-main {
background-image: url('../manjitcss/img/manjit-main.png');
background-size: cover;
background-position: center;
padding: 10em 0;
}
#media(min-width:40rem) {
.logo {
float: left;
margin-top: .5em;
}
nav {
float: right;
}
}
#media(min-width:60rem) {
.logo {
width: 250px;
height: 50px;
}
nav {
margin-top: .5em;
}
nav a {
font-size: 1.04em;
}
}
<header class="clearfix">
<img src="http://placehold.it/50x50" alt="Foo logo" class="logo" />
<nav>
<ul>
<li>Home</li>
<li>About Me</li>
<li>Contact</li>
</ul>
</nav>
</header>
<section class="home-main">
<div class="container">
container
</div>
</section>
When you use float try to use overflow property on parent. As float leaves its parent. Or you can use clearfix also.
This is an issue with float. You may use clearfix or apply float for .home-main as below
#media(min-width:40rem) {
.logo {
float: left;
margin-top: .5em;
}
nav {
float: right;
}
.home-main{
width: 100%;
float: left;
}
}
A section consists of a navigation group with elements floated to the sides, a center text group, and a background image. The section height was not manually set to fit the background image.
How do I go about vertically centering the text group? It is div.h1-container.
Plunkr: https://plnkr.co/edit/rSWgdfPQEbIeXbPh4wO1?p=preview
body {
font: 15px/1.5 Arial, Helvetica, sans-serif;
padding: 0;
margin: 0;
background-color: #f4f4f4;
}
/* Global */
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
.clear {
clear: both;
}
ul {
margin: 0;
padding: 0;
}
section h2 {
line-height: 1.0;
}
.button_1 {
height: 34px;
background: tomato;
border: 0;
padding-left: 20px;
padding-right: 20px;
color: #ffffff;
width: 200px;
}
.showcase-nav a {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
.showcase-nav {
padding-top: 30px;
margin-top: 10px;
float: right;
}
.showcase-nav li.social i {
padding: 0 4px;
}
.showcase-nav li {
display: inline;
padding: 0 20px 0 20px;
}
.showcase-branding {
float: left;
}
.showcase-branding h1 {
font-size: 26px;
margin: 0;
padding-top: 30px;
color: #fff;
}
.showcase-branding .highlight {
color: #e8491d;
font-weight: bold;
}
.showcase-nav a:hover {
color: #cccccc;
font-weight: bold;
}
.h1-container {
width: 70%;
margin: auto;
}
.h1-container h1 {
text-transform: uppercase;
text-align: center;
color: #fff;
}
.h1-container p {
width: 81%;
background: tomato;
margin: auto;
border-radius: 10px;
text-align: center;
color: #fff;
}
/* Showcase */
#showcase {
background: url('http://i68.tinypic.com/2j5jho4.png') no-repeat;
background-size: contain;
width: 100%;
display: inline-block;
position: relative;
margin: 0 auto;
}
#showcase:after {
padding-top: 51.46%;
display: block;
content: '';
}
#showcase .container {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
}
#showcase .h1-container h1 {
font-size: 55px;
margin-bottom: 10px;
}
#showcase p {
font-size: 20px;
padding: 5px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<section id="showcase">
<div class="container">
<div class="showcase-branding">
<h1>Title</h1>
</div>
<nav class="showcase-nav">
<ul>
<li class="current">About</li>
<li>Contact</li>
<li class="social"><i class="fa fa-linkedin-square"></i><i class="fa fa-facebook-official"></i><i class="fa fa-twitter"></i></li>
</ul>
</nav>
<div class="clear"></div>
<div class="h1-container">
<h1>Text on line 1<br>text on line 2</h1>
<p>lorem ipsum lorem ipsum lorem ipsum lorem ipsum <i class="fa fa-caret-right"></i></p>
</div>
</div>
</section>
Given the current context there are two simple ways to go about this.
One way would be to give .h1-container display: flex, flex-direction: column, and justify-content: center.
Here is a jsfiddle.
However, if you were to do it this way, each element and every new element placed in .h1-container will end up being stacked vertically and centered vertically in relation to .h1-container, so it will appear as if the children elements are not centered if .h1-container is not properly centered.
Also remember that justify-content always positions the children elements relative to the direction of the flex-box. Therefore, if your flex-box direction is not explicitly set, and since the default is flex-direction: row, justify-content would position the children horizontally. align-items will always be the opposite of the flex-box's direction property.
body {
font: 15px/1.5 Arial, Helvetica, sans-serif;
padding: 0;
margin: 0;
background-color: #f4f4f4;
}
/* Global */
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
.clear {
clear: both;
}
ul {
margin: 0;
padding: 0;
}
section h2 {
line-height: 1.0;
}
.button_1 {
height: 34px;
background: tomato;
border: 0;
padding-left: 20px;
padding-right: 20px;
color: #ffffff;
width: 200px;
}
.showcase-nav a {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
.showcase-nav {
padding-top: 30px;
margin-top: 10px;
float: right;
}
.showcase-nav li.social i {
padding: 0 4px;
}
.showcase-nav li {
display: inline;
padding: 0 20px 0 20px;
}
.showcase-branding {
float: left;
}
.showcase-branding h1 {
font-size: 26px;
margin: 0;
padding-top: 30px;
color: #fff;
}
.showcase-branding .highlight {
color: #e8491d;
font-weight: bold;
}
.showcase-nav a:hover {
color: #cccccc;
font-weight: bold;
}
.h1-container {
width: 70%;
margin: auto;
display: flex;
flex-direction: column;
justify-content: center;
}
.h1-container h1 {
text-transform: uppercase;
text-align: center;
color: #fff;
}
.h1-container p {
width: 81%;
background: tomato;
margin: auto;
border-radius: 10px;
text-align: center;
color: #fff;
}
/* Showcase */
#showcase {
background: url('http://i68.tinypic.com/2j5jho4.png') no-repeat;
background-size: contain;
width: 100%;
display: inline-block;
position: relative;
margin: 0 auto;
}
#showcase:after {
padding-top: 51.46%;
display: block;
content: '';
}
#showcase .container {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
}
#showcase .h1-container h1 {
font-size: 55px;
margin-bottom: 10px;
}
#showcase p {
font-size: 20px;
padding: 5px;
}
<body>
<section id="showcase">
<div class="container">
<div class="showcase-branding">
<h1>Title</h1>
</div>
<nav class="showcase-nav">
<ul>
<li class="current">About</li>
<li>Contact</li>
<li class="social"><i class="fa fa-linkedin-square"></i><i class="fa fa-facebook-official"></i><i class="fa fa-twitter"></i></li>
</ul>
</nav>
<div class="clear"></div>
<div class="h1-container">
<h1>Text on line 1<br>text on line 2</h1>
<p>lorem ipsum lorem ipsum lorem ipsum lorem ipsum <i class="fa fa-caret-right"></i></p>
</div>
</div>
</section>
</body>
The other way would be to give .container position: relative, and then give .h1-container position: absolute, top: 50%, and transform: translateY(-50%).
Positioning .container as relative allows you to absolutely position .h1-container in relation to .container as opposed to the entire document.
.container {
position: relative;
}
.h1-container {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
Here is a jsfiddle.
The following is an inline version which won't display properly due to the dimensions of everything, but it has at least centered the .h1-container.
body {
font: 15px/1.5 Arial, Helvetica, sans-serif;
padding: 0;
margin: 0;
background-color: #f4f4f4;
}
/* Global */
.container {
width: 80%;
margin: auto;
overflow: hidden;
position: relative;
}
.clear {
clear: both;
}
ul {
margin: 0;
padding: 0;
}
section h2 {
line-height: 1.0;
}
.button_1 {
height: 34px;
background: tomato;
border: 0;
padding-left: 20px;
padding-right: 20px;
color: #ffffff;
width: 200px;
}
.showcase-nav a {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
.showcase-nav {
padding-top: 30px;
margin-top: 10px;
float: right;
}
.showcase-nav li.social i {
padding: 0 4px;
}
.showcase-nav li {
display: inline;
padding: 0 20px 0 20px;
}
.showcase-branding {
float: left;
}
.showcase-branding h1 {
font-size: 26px;
margin: 0;
padding-top: 30px;
color: #fff;
}
.showcase-branding .highlight {
color: #e8491d;
font-weight: bold;
}
.showcase-nav a:hover {
color: #cccccc;
font-weight: bold;
}
.h1-container {
width: 70%;
margin: auto;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.h1-container h1 {
text-transform: uppercase;
text-align: center;
color: #fff;
}
.h1-container p {
width: 81%;
background: tomato;
margin: auto;
border-radius: 10px;
text-align: center;
color: #fff;
}
/* Showcase */
#showcase {
background: url('http://i68.tinypic.com/2j5jho4.png') no-repeat;
background-size: contain;
width: 100%;
display: inline-block;
position: relative;
margin: 0 auto;
}
#showcase:after {
padding-top: 51.46%;
display: block;
content: '';
}
#showcase .container {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
}
#showcase .h1-container h1 {
font-size: 55px;
margin-bottom: 10px;
}
#showcase p {
font-size: 20px;
padding: 5px;
}
<body>
<section id="showcase">
<div class="container">
<div class="showcase-branding">
<h1>Title</h1>
</div>
<nav class="showcase-nav">
<ul>
<li class="current">About</li>
<li>Contact</li>
<li class="social"><i class="fa fa-linkedin-square"></i><i class="fa fa-facebook-official"></i><i class="fa fa-twitter"></i></li>
</ul>
</nav>
<div class="clear"></div>
<div class="h1-container">
<h1>Text on line 1<br>text on line 2</h1>
<p>lorem ipsum lorem ipsum lorem ipsum lorem ipsum <i class="fa fa-caret-right"></i></p>
</div>
</div>
</section>
</body>
I have a Horizontal Menu. When the mouse is hovered over the child elements it disappears. The child elements cannot be clicked. I would like the child elements to stay when the mouse is hovered over it.
.header {
color: #FFFFFF;
height: 60px;
width: 100%;
margin: auto;
}
.header_logo {
width: 40%;
height: 100%;
float: left;
}
#logo {
height: 100%;
top: 0;
left: 0;
width: 50%;
}
.header_title {
width: 60%;
float: left;
}
#titles {
position: absolute;
top: 20px;
font-family: "Times New Roman", Times, serif, Georgia;
font-size: 97%;
color: #B8B8B8;
}
ul {
list-style-type: none;
}
li {
display: inline-block;
}
a {
text-decoration: none;
color: inherit;
padding: 21px 10px;
}
li a:hover {
background-color: #666699;
}
ul li ul {
display: none;
}
ul li:hover ul {
display: block;
position: absolute;
width: 100%;
top: 70px;
left: 0;
white-space: nowrap;
}
* {
border: 0;
margin: 0;
padding: 0;
}
.content {
height: 800px;
margin: auto;
background-color: #C0C0C0;
}
.footer {
margin: auto;
background-color: #000000;
}
<div class="header">
<div class="header_logo">
<img id="logo" src="civic-logo.jpg">
</div>
<div class="header_title">
<div id="titles">
<ul>
<li>PRODUCTS
<ul>
<li>CEMENT</li>
<li>STEEL</li>
<li>BRICKS</li>
<li>SAND</li>
</ul>
</li>
<li>CONTACT US </li>
</ul>
</div>
</div>
</div>
<div class="content">
</div>
<div class="footer">
</div>
It's because you have positioned your submenu absolutely, and it's too far away from your parent li, so your mouse is leaving the parent menu before it reaches the submenu. I've added borders to show you.
.header {
color: #FFFFFF;
height: 60px;
width: 100%;
margin: auto;
}
.header_logo {
width: 40%;
height: 100%;
float: left;
}
#logo {
height: 100%;
top: 0;
left: 0;
width: 50%;
}
.header_title {
width: 60%;
float: left;
}
#titles {
position: absolute;
top: 20px;
font-family: "Times New Roman", Times, serif, Georgia;
font-size: 97%;
color: #B8B8B8;
}
ul {
list-style-type: none;
}
li {
display: inline-block;
border: 1px solid blue;
}
a {
text-decoration: none;
color: inherit;
padding: 21px 10px;
}
li a:hover {
background-color: #666699;
}
ul li ul {
display: none;
}
ul li:hover ul {
display: block;
position: absolute;
width: 100%;
top: 70px;
left: 0;
white-space: nowrap;
}
* {
border: 0;
margin: 0;
padding: 0;
}
.content {
height: 800px;
margin: auto;
background-color: #C0C0C0;
}
.footer {
margin: auto;
background-color: #000000;
}
<div class="header">
<div class="header_logo">
<img id="logo" src="civic-logo.jpg">
</div>
<div class="header_title">
<div id="titles">
<ul>
<li>PRODUCTS
<ul>
<li>CEMENT</li>
<li>STEEL</li>
<li>BRICKS</li>
<li>SAND</li>
</ul>
</li>
<li>CONTACT US </li>
</ul>
</div>
</div>
</div>
<div class="content">
</div>
<div class="footer">
</div>
You have padding, but it's on your a element, and needs to be on your li element, instead. Either add padding-top to your submenu li elements or adjust their top position so that they're directly underneath (aka "touching") the parent element.
Here is the code with the menu moved to top: 40px and the padding added to the submenu li elements:
.header {
color: #FFFFFF;
height: 60px;
width: 100%;
margin: auto;
}
.header_logo {
width: 40%;
height: 100%;
float: left;
}
#logo {
height: 100%;
top: 0;
left: 0;
width: 50%;
}
.header_title {
width: 60%;
float: left;
}
#titles {
position: absolute;
top: 20px;
font-family: "Times New Roman", Times, serif, Georgia;
font-size: 97%;
color: #B8B8B8;
}
ul {
list-style-type: none;
}
li {
display: inline-block;
}
a {
text-decoration: none;
color: inherit;
padding: 21px 10px;
}
li ul li {
padding: 21px 10px;
}
li a:hover {
background-color: #666699;
}
ul li ul {
display: none;
}
ul li:hover ul {
display: block;
position: absolute;
width: 100%;
top: 40px;
left: 0;
white-space: nowrap;
}
* {
border: 0;
margin: 0;
padding: 0;
}
.content {
height: 800px;
margin: auto;
background-color: #C0C0C0;
}
.footer {
margin: auto;
background-color: #000000;
}
<div class="header">
<div class="header_logo">
<img id="logo" src="civic-logo.jpg">
</div>
<div class="header_title">
<div id="titles">
<ul>
<li>PRODUCTS
<ul>
<li>CEMENT</li>
<li>STEEL</li>
<li>BRICKS</li>
<li>SAND</li>
</ul>
</li>
<li>CONTACT US </li>
</ul>
</div>
</div>
</div>
<div class="content">
</div>
<div class="footer">
</div>
I want to align the list items horizontally. But i'm not getting them in a line. If i remove the br tag inside the first li then its aligning perfectly. What am i missing? please help. jsfiddle code -> here
html:
<div id="info_new_cont">
<ul id="info_new_ul">
<li id="app_no_li">
<div>
<div id="app_no_title">Appn<br> No:</div>
<div id="app_no" class="info_new_bottom">42382464</div>
</div>
</li>
<li id="new_li">
<div>mcs</div>
<div id="new_case" class="info_new_bottom">New Case</div>
</li>
<li id="ifw_li">
<div>ld</div>
<div id="file_wrap" class="info_new_bottom">More Info</div>
</li>
</ul>
</div>
here is the style
#info_new_cont {
float: right;
display: inline-block;
width: 500px;
height: 100%;
margin: 0px;
}
#info_new_ul {
list-style: none;
margin: 0px;
width: 400px;
height: 140px;
}
#info_new_ul li {
display: inline-block;
padding: 5px;
color: #fff;
font-family: trebuchet ms;
font-size: 19px;
font-weight: lighter;
text-align: justify;
word-wrap:break-word;
}
.info_new_bottom {
margin-top:30px;
}
#app_no_li {
width: 120px;
height: 120px;
background-color: #00ddff;
}
#app_no_cont {
white-space: nowrap;
}
#app_no_title {
}
#app_no {
font-weight: bold;
}
#new_li {
width: 120px;
height: 120px;
background-color: #eee;
}
#ifw_li {
width: 120px;
height: 120px;
background-color: #eee;
}
Delete the display: inline-block; from de #info_new_ul li
and use a float:left for the <li>.
#info_new_ul li {
....
float:left;
}
Your JsFiddle but updated with the new code
You should use float:left for li tags.
#info_new_ul li {
float:left;
margin-left: 2px;
padding: 5px;
color: #fff;
font-family: trebuchet ms;
font-size: 19px;
font-weight: lighter;
text-align: justify;
word-wrap:break-word;
}
DEMO
So I'm trying to figure out a way to make the tabs in my navigation bar clickable as well as the link text. Adding padding: 20px 30px; makes the second to last tab shift up and the text shift to the right. I'm willing to do some major alterations so please any answer is a good one.Here's my HTML.
<div id="tab_container">
<nav id="tabs">
<ul id="nav">
<li class="active">About</li>
<li class="inactive">Services</li>
<li class="inactive">Our Staff</li>
<li class="inactive">book</li>
<li class="inactive">Gift Cards</li>
<li class="inactive">Reviews</li>
</ul>
</nav>
</div>
Heres the CSS...
#tab_container
{
background-color: #222;
display: -webkit-box;
-webkit-box-flex: 1;
display: block;
position: relative;
max-width: 970px;
width: 100%;
text-align: center;
}
#tabs
{
float: left;
margin-top: 0px;
width: 100%;
max-width: 970px;
background-color: #222;
padding-top: 20px;
text-align: center;
}
#nav
{
width: 100%;
max-width: 970px;
text-align: center;
}
ul
{
float: left;
max-width: 970px;
display: -webkit-box;
-webkit-box-flex: 1;
width: 100%;
padding-left: 0px;
margin-bottom: 0px;
margin-top: 0px;
margin-right: 0px;
text-align: center;
}
ul li
{
display: inline-block;
text-align: center;
width: 158px;
height: 70px;
background-color: black;
font-size: 18px;
text-transform: uppercase;
text-align: center;
margin:0 auto;
padding: 0;
}
ul li a
{
color: #54544b;
text-decoration: none;
text-align: center;
margin: 0px auto;
line-height: 70px;
padding: 20px 30px;
}
a:hover
{
color: #CF7BA1;
}
.active a
{
text-decoration: underline;
color: #CF7BA1;
}
set display-blocks to A:
ul li a {
display:block;
height:100%;
width:100%;
line-height:XXpx;
}