border on bootstrap tabs content - css

I want to add a border to my tab content. There should be no border at the bottom of the selected tab. I found this questions: how to give a border to bootstrap tab contents, but the answers didn't work for me?
HTML:
<ul class="nav nav-tabs pull-right">
<li><a data-toggle="tab" href="#sub_cats_8">תתי קטגוריות</a></li>
<li class="active"><a data-toggle="tab" href="#category_8">קטגוריה</a></li>
</ul>
<div class="clearfix"></div>
<div class="tab-content" style="height: 100%;">
<div id="category_8" class="tab-pane fade in active category" style="background-image: url('example.jpg');">
<h1> קוסמטיקה </h1>
</div>
<div id="sub_cats_8" class="tab-pane fade">
<ul class="sub_categories">
<li>איפור</li>
</ul>
</div>
</div>
CSS:
body, html {
direction: rtl;
height: 100%;
font-family: Tahoma;
}
.nav-tabs {
direction: ltr;
}
#logo {
background-color: #005CB8;
width: 100%;
color: white;
padding: 4% 10%;
-webkit-box-shadow: 20px 10px 20px #003972;
-moz-box-shadow: 20px 10px 20px #003972;
box-shadow: 20px 10px 20px #003972;
border-bottom-left-radius: 50px;
}
#logo h1, #logo h4 {
display: inline;
font-family: head;
}
#logo h1 {
font-size: 550%;
}
#logo h4 {
font-size: 220%;
}
.navbar-inverse {
background-color: #477199;
font-weight: bold;
}
.nav.navbar-nav.navbar-right li a {
color: white;
}
.nav.navbar-nav li a {
color: white;
}
.navbar-inverse .navbar-nav > .active {
background-color: #003972;
}
.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus {
color: white;
background: #003972;
}
.navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus {
background-color: #324F6B;
color: white;
}
.category {
text-align: center;
margin-top: 1px;
background-size: 100% 100%;
padding: 15% 0;
}
.category h1 {
color: white;
font-family: head;
font-size: 500%;
text-shadow: 2px -2px black;
}
.category_start {
margin: 0 auto;
width: 85%;
}
.sub_categories {
-webkit-columns: auto 3;
/* Chrome, Safari, Opera */
-moz-columns: auto 3;
/* Firefox */
columns: auto 3;
list-style-type: disc;
margin-top: 5px;
}
.category_start .container {
margin-top: 10px;
}
.product_image {
height: 80px;
width: 80px;
}
.products_sub_list {
margin: 10px auto 0;
text-align: center;
max-width: 80%;
border-radius: 7px;
}
.products_sub_list td {
width: 15%;
max-width: 15%;
padding: 0 5px;
border: 3px solid #46617A;
}
.product {
width: 80%;
border: 3px solid #46617A;
margin: 0 auto;
text-align: center;
border-radius: 10px;
}
.product_table td {
border: 2px solid #46617A;
padding: 13px;
}
.product_table {
display: inline-table;
margin-left: 15px;
margin-bottom: 8px;
}
.product_table td:first-child {
font-weight: bold;
}
.page {
width: 85%;
margin: 0 auto;
padding: 15px 25px;
border: 2px solid #46617A;
border-radius: 10px;
background-color: #C8D0D7;
}
.register {
margin: 0 auto;
width: 80%;
text-align: center;
}
.register td {
padding: 5px;
text-align: right;
}
.register table {
margin-right: 240px;
}
#register {
width: 80%;
position: absolute;
z-index: 2;
display: none;
left: 0;
right: 0;
top: 100px;
margin: 0 auto;
border: 3px solid #0066FF;
background-color: #CCE0FF;
text-align:center;
border-radius: 10px;
}
#bbg {
display: none;
position: absolute;
z-index: 1;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: black;
opacity: 0.8;
filter: alpha(opacity=80);
}
.tab-content {
border: 1px solid #ddd;
padding: 1px;
}
JSFiddle: http://jsfiddle.net/ep2drocb/7/
Notice there is border in the open tab, also the closed tabs have a double border.

The main problem is the pull-right on the ul element.
Remove pull-right class from the ul
Remove the clear-fix element as it's not needed anymore
Remove top border from your tab-content class
Float the lis right
Correct the margins on the tab anchors
Relevant HTML:
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#category_8">תתי קטגוריות</a></li>
<li><a data-toggle="tab" href="#sub_cats_8">קטגוריה</a></li>
</ul>
<div class="tab-content">
<div id="category_8" class="tab-pane fade in active category">
<h1> קוסמטיקה </h1>
</div>
<div id="sub_cats_8" class="tab-pane fade">
<ul class="sub_categories">
<li>איפור</li>
</ul>
</div>
</div>
Relevant CSS:
.tab-content {
border: 1px solid #ddd;
border-width: 0 1px 1px; /* Removes the top border */
padding: 1px;
}
.nav-tabs > li {
float: right;
}
.nav-tabs > li > a {
margin-right: 0;
margin-left: 2px;
}
JSFiddle: http://jsfiddle.net/ep2drocb/9/
That should get you on the right track.

Related

Header will not expand and list items hidden from view

I have 2 issues with my test page. I'm trying to get header to take up width of page. I set the width to 100% but it still will not expand out to width of page. And the dropdown for the "Links" item appears behind the wrapper element and therefore it is not possible to click on any of the underlying links. Thank you.
Codepen: https://codepen.io/centem/pen/dBdwxw
header {
margin: 0 auto;
width: 100%
height: 40px;
}
header ul {
height: 40px;
margin: 0px;
padding: 0px;
list-style: none;
}
header ul li {
float: left;
width: 200px;
height: 40px;
background-color: black;
opacity: .75;
line-height: 40px;
text-align: center;
font-size: 20px;
color: white;
}
header ul li a {
text-decoration: none;
display: block;
}
header ul li a:hover {
background-color: green;
}
header ul li ul li {
display:none;
}
ul li:hover ul li {
display: block;
}
header is already set to 100% witdth. However, you've set fixed width and the background to the li. You can simply use flexbox and set flex: 1 to the items without worrying about their width.
body {
margin: 0 auto;
font: 1.1em;
background-image: url('CNDsplash.jpg');
background-repeat: no-repeat;
background-position: center;
}
h1,
h2,
h3,
h4,
h5 {
font-weight: 400;
}
header {
margin: 0 auto;
width: 100%;
height: 40px;
}
header ul {
height: 40px;
margin: 0px;
padding: 0px;
list-style: none;
display: flex;
}
header ul li {
height: 40px;
flex: 1;
background-color: black;
opacity: .75;
line-height: 40px;
text-align: center;
font-size: 20px;
color: white;
}
header ul li a {
text-decoration: none;
display: block;
}
header ul li a:hover {
background-color: green;
}
header ul li ul li {
display: none;
}
ul li:hover ul li {
display: block;
}
#title-heading {
float: left;
}
.hidden {
display: none;
}
.wrapper {
width: 100%;
max-width: 600px;
margin: 0 auto;
border: 2px solid #eee;
background: #fefefe;
opacity: 0.9;
filter: alpha(opacity=90);
/* for ie8 and earlier */
}
.upload-console {
/*background: #fefefe;*/
/*border: 2px solid #eee; */
padding: 20px;
/*opacity: 0.9;*/
/*filter: alpha(opacity=50);*/
/* for IE8 and earlier */
}
.upload-console-header {
padding: 0 0 20px 0;
margin: 0;
border-bottom: 2px solid #eee;
font-weight: 600;
margin-bottom: 20px;
}
.upload-console-drop {
height: 200px;
border: 2px dashed #ccc;
line-height: 200px;
color: #ccc;
text-align: center;
margin-bottom: 20px;
}
.upload-console-drop.drop {
border-color: #222;
color: #222;
}
.upload-console-body {
margin-bottom: 20px;
}
.bar {
width: 100%;
background: #eee;
padding: 3px;
border-radius: 3px;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
box-sizing: border-box;
margin-bottom: 20px;
}
.bar-fill {
height: 30px;
display: block;
background: cornflowerblue;
width: 0;
border-radius: 3px;
-webkit-transition: width 0.8s ease;
transition: width 0.8s ease;
}
.bar-fill-text {
color: #fff;
line-height: 30px;
margin-left: 5px;
}
.upload-console-upload {
border-bottom: 2px solid #ccc;
margin-bottom: 10px;
padding-bottom: 10px;
}
.upload-console-upload span {
float: right;
}
<header>
<ul>
<li><a>Home</a></li>
<li><a>Contact</a></li>
<li><a>Docs</a></li>
<li><a>Links</a>
<ul>
<li><a>Link 1</a></li>
<li><a>Link 2</a></li>
<li><a>Link 3</a></li>
</ul>
</li>
</ul>
</header>
<div class="wrapper">
<div id="form-heading">
</div>
<div class="upload-console">
<br>
<h2 class="upload-console-header">FTS</h2>
<div class="upload-console-body">
<h3>Select files</h3>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="files[]" id="standard-upload-files" multiple>
<input type="submit" value="Upload files" id="standard-upload">
</form>
<h3>Or drag and drop files below</h3>
<div class="upload-console-drop" id="drop-zone">
Just drag and drop files here
</div>
<div class="bar">
<div class="bar-fill" id="bar-fill">
<div class="bar-fill-text" id="bar-fill-text"></div>
</div>
</div>
<div id="uploads-finished" class="hidden">
<h3>Processed Files</h3>
</div>
</div>
</div>
</div>
body {
margin: 0 auto;
font: 1.1em;
background-image: url('CNDsplash.jpg');
background-repeat: no-repeat;
background-position: center;
}
h1,
h2,
h3,
h4,
h5 {
font-weight: 400;
}
header {
margin: 0 auto;
width: 100% height: 40px;
}
header ul {
height: 40px;
margin: 0px;
padding: 0px;
list-style: none;
display: flex;
z-index: 1;
position: relative;
}
header ul li {
display: flex;
flex-grow: 1;
height: 40px;
background-color: black;
opacity: .75;
line-height: 40px;
text-align: center;
font-size: 20px;
color: white;
}
header ul li a {
text-decoration: none;
display: block;
width: 100%;
}
header ul li a:hover {
background-color: green;
}
header ul li ul li {
display: none;
}
ul li:hover ul li {
display: block;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 100%;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
#title-heading {
float: left;
}
.hidden {
display: none;
}
.wrapper {
width: 100%;
max-width: 600px;
margin: 0 auto;
border: 2px solid #eee;
background: #fefefe;
opacity: 0.9;
filter: alpha(opacity=90);
/* for ie8 and earlier */
}
.upload-console {
/*background: #fefefe;*/
/*border: 2px solid #eee; */
padding: 20px;
/*opacity: 0.9;*/
/*filter: alpha(opacity=50);*/
/* for IE8 and earlier */
}
.upload-console-header {
padding: 0 0 20px 0;
margin: 0;
border-bottom: 2px solid #eee;
font-weight: 600;
margin-bottom: 20px;
}
.upload-console-drop {
height: 200px;
border: 2px dashed #ccc;
line-height: 200px;
color: #ccc;
text-align: center;
margin-bottom: 20px;
}
.upload-console-drop.drop {
border-color: #222;
color: #222;
}
.upload-console-body {
margin-bottom: 20px;
}
.bar {
width: 100%;
background: #eee;
padding: 3px;
border-radius: 3px;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
box-sizing: border-box;
margin-bottom: 20px;
}
.bar-fill {
height: 30px;
display: block;
background: cornflowerblue;
width: 0;
border-radius: 3px;
-webkit-transition: width 0.8s ease;
transition: width 0.8s ease;
}
.bar-fill-text {
color: #fff;
line-height: 30px;
margin-left: 5px;
}
.upload-console-upload {
border-bottom: 2px solid #ccc;
margin-bottom: 10px;
padding-bottom: 10px;
}
.upload-console-upload span {
float: right;
}
<header>
<ul>
<li><a>Home</a></li>
<li><a>Contact</a></li>
<li class="dropdown"><a>Links</a>
<ul class="dropdown-content">
<li><a>Link 1</a></li>
<li><a>Link 2</a></li>
<li><a>Link 3</a></li>
</ul>
</li>
</ul>
</header>
<div class="wrapper">
<div id="form-heading">
</div>
<div class="upload-console">
<br>
<h2 class="upload-console-header">FTS</h2>
<div class="upload-console-body">
<h3>Select files</h3>
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="files[]" id="standard-upload-files" multiple>
<input type="submit" value="Upload files" id="standard-upload">
</form>
<h3>Or drag and drop files below</h3>
<div class="upload-console-drop" id="drop-zone">
Just drag and drop files here
</div>
<div class="bar">
<div class="bar-fill" id="bar-fill">
<div class="bar-fill-text" id="bar-fill-text"></div>
</div>
</div>
<div id="uploads-finished" class="hidden">
<h3>Processed Files</h3>
</div>
</div>
</div>
</div>
<script src="upload.js"></script>
<script src="global.js"></script>

The submenu is not displayed

I can't get the submenu to be displayed.
Here's my code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title><?php echo $title; ?></title>
<style type="text/css">
body
{
font-family: lucida grande ,tahoma,verdana,arial,sans-serif;
background-color: #e9e9e9;
}
body p
{
font-size: 0.8em;
line-height: 1.28;
}
#wrapper
{
width: 1080px;
background-color: white;
margin: 0 auto;
padding: 10px;
border: 5px solid #dedede;
}
#banner
{
background-repeat: no-repeat;
background-size: cover;
border: 5px solid #dedede;
height: 200px;
}
#content_area
{
float: left;
width: 750px;
margin: 20px 0 20px 0;
padding: 10px;
}
#sidebar
{
float: right;
width: 250px;
height: 400px;
margin: 20px 10px;
padding: 10px;
border: 2px solid #E3E3E3;
}
footer
{
clear: both;
width: auto;
height: 40px;
padding: 10px;
border: 3px solid #E3E3E3;
text-align: center;
color: #fff;
text-shadow: 0.1em 0.1em #333;
background-image: url(../Images/bar_background.png);
}
#navigation
{
height: 60px;
border: 3px solid #E3E3E3;
margin-top: 20px;
text-shadow: 0.1em 0.1em #333;
background-image: url(../Images/bar_background.png);
}
#nav
{
list-style: none;
}
#nav ul
{
margin: 0;
padding: 0;
width: auto;
display: none;
}
#nav li
{
font-size: 24px;
float: left;
position: relative;
width: 180px;
height: 50px;
}
#nav a:link, nav a:active, nav a:visited
{
display: block;
color: #fff;
text-decoration: none;
}
#nav a:hover
{
color: lightblue;
}
#subnav
{
list-style:none;
}
#subnav ul
{
margin: 0;
padding: 0;
width: auto;
display:none;
}
#subnav li
{
font-size: 24px;
float:inside;
position: relative;
width: 180px;
height: 50px;
}
#subnav a:link, nav a:active, nav a:visited
{
display: block;
color: #fff;
text-decoration: none;
}
#subnav a:hover
{
color: lightblue;
}
.imgLeft
{
float: left;
width: 240px;
height: 150px;
margin: 0px 10px 10px 0;
padding: 10px;
}
.imgRight
{
float: right;
width: 200px;
height: 250px;
margin: 0px 0 10px 10px;
padding: 10px;
}
</style>
</head>
/*Master page code */
/*the submenu 'subproducts' is not displayed when i ran my code */
<body>
<div id="wrapper">
<div id="banner">
</div>
<nav id="navigation">
<ul id="nav">
<li>Home</li>
<li>Products
<ul id="subnav">
<li>SubProducts</li>
</ul>
</li>
<li>Shop</li>
<li>About</li>
</ul>
</nav>
<div id="content_area">
<?php echo $content; ?>
</div>
<div id="sidebar">
</div>
<footer>
<p>All rights reserved</p>
</footer>
</div>
</body>
</html>
I added this:
#nav li:hover ul {
display: block;
}
body {
font-family: lucida grande, tahoma, verdana, arial, sans-serif;
background-color: #e9e9e9;
}
body p {
font-size: 0.8em;
line-height: 1.28;
}
#wrapper {
width: 1080px;
background-color: white;
margin: 0 auto;
padding: 10px;
border: 5px solid #dedede;
}
#banner {
background-repeat: no-repeat;
background-size: cover;
border: 5px solid #dedede;
height: 200px;
}
#content_area {
float: left;
width: 750px;
margin: 20px 0 20px 0;
padding: 10px;
}
#sidebar {
float: right;
width: 250px;
height: 400px;
margin: 20px 10px;
padding: 10px;
border: 2px solid #E3E3E3;
}
footer {
clear: both;
width: auto;
height: 40px;
padding: 10px;
border: 3px solid #E3E3E3;
text-align: center;
color: #fff;
text-shadow: 0.1em 0.1em #333;
background-image: url(../Images/bar_background.png);
}
#navigation {
height: 60px;
border: 3px solid #E3E3E3;
margin-top: 20px;
text-shadow: 0.1em 0.1em #333;
background-image: url(../Images/bar_background.png);
}
#nav {
list-style: none;
}
#nav ul {
margin: 0;
padding: 0;
width: auto;
display: none;
}
#nav li {
font-size: 24px;
float: left;
position: relative;
width: 180px;
height: 50px;
}
#nav li:hover ul {
display: block;
}
#nav a:link,
nav a:active,
nav a:visited {
display: block;
color: #fff;
text-decoration: none;
}
#nav a:hover {
color: lightblue;
}
#subnav {
list-style: none;
}
#subnav ul {
margin: 0;
padding: 0;
width: auto;
display: none;
}
#subnav li {
font-size: 24px;
float: inside;
position: relative;
width: 180px;
height: 50px;
}
#subnav a:link,
nav a:active,
nav a:visited {
display: block;
color: #fff;
text-decoration: none;
}
#subnav a:hover {
color: lightblue;
}
<div id="wrapper">
<div id="banner">
</div>
<nav id="navigation">
<ul id="nav">
<li>Home</li>
<li>Products
<ul id="subnav">
<li>SubProducts</li>
</ul>
</li>
<li>Shop</li>
<li>About</li>
</ul>
</nav>
<div id="content_area">
<!--<?php echo $content; ?>-->
</div>
<div id="sidebar">
</div>
<footer>
<p>All rights reserved</p>
</footer>
</div>

Submenu disappears in Flexbox

When I try to add a site navigation into a flexbox layout the submenus become not accessible anymore. They disappear when the mouse leaves the parent list element.
The final goal is to make the navigation fixed by using flexbox. If the body- and header-tag are left out the navigation works like intended. Any ideas on this?
* {
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
}
header {
flex: 0 0 auto;
background: yellow;
}
.site-navigation {
font-family: 'Open Sans', 'Helvetica', 'Arial', sans-serif;
font-weight: 400;
color: #666;
}
nav ul {
background: none;
display: flex;
flex-direction: column;
}
nav ul li {
list-style-type: none;
background: none;
}
nav ul li:hover {
background: none;
}
nav ul li a {
padding: 0.8rem 1rem;
display: block;
text-decoration: none;
color: rgba(100, 100, 100, 0.8);
background: none;
text-transform: uppercase;
font-size: 12px;
}
.has-children:hover>a {
border: 1px solid #e5e5e5;
border-bottom: none;
background: #fff;
margin-left: -1px;
margin-right: -1px;
margin-top: -1px;
color: #000;
}
.has-children:hover>ul {
border: 1px solid #e5e5e5;
position: relative;
z-index: -1;
}
.has-children:hover>ul>li {
padding: 15px 15px;
}
.has-children>ul>li>a {
text-transform: none;
color: #666;
border-bottom: 1px solid #E5E5E5;
padding: 0;
padding-bottom: 15px;
}
.has-children>ul>li:hover>a {
border-bottom: 2px solid #d00;
color: #000;
padding-bottom: 14px;
}
#media only screen and (min-width:680px) {
nav ul {
flex-direction: row;
}
nav ul li {
position: relative;
flex: 0 0 auto;
text-align: left;
}
nav ul li:hover ul {
display: flex;
flex-direction: column;
}
.has-children ul {
display: none;
position: absolute;
top: 100%;
}
.has-children:hover ul {
display: block;
position: absolute;
top: calc( 100% - 1px);
width: 150%;
}
}
<header class="site-header">
<nav class="site-navigation">
<ul class="site-navigation__list">
<li class="site-navigation__item">Item 1
</li>
<li class="site-navigation__item has-children">Item 2<span class="arrow arrow-down"></span>
<ul class="site-navigation__sub-list">
<li class="site-navigation__sub-item">Subitem 1</li>
<li class="site-navigation__sub-item">Subitem 2</li>
</ul>
</li>
</ul>
</nav>
</header>
<div class="content"><p>Content goes here!</p></div>
It seems to be a matter of z-index and background.
You may use position:relative to reset z-index and add a background to submenu to hide overlapped content.
CSS update that could be done:
nav ul {
position:relative;
z-index:1
}
nav ul li:hover > ul{
background: white;
}
* {
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
}
header {
flex: 0 0 auto;
background: yellow;
}
.site-navigation {
font-family: 'Open Sans', 'Helvetica', 'Arial', sans-serif;
font-weight: 400;
color: #666;
}
nav ul {
background: none;
display: flex;
flex-direction: column;
}
nav ul {
position:relative;
z-index:1
}
nav ul li:hover > ul{
background: white;
}
nav ul li ,nav ul li:hover{
list-style-type: none;
background: none;
}
nav ul li a {
padding: 0.8rem 1rem;
display: block;
text-decoration: none;
color: rgba(100, 100, 100, 0.8);
background: none;
text-transform: uppercase;
font-size: 12px;
}
.has-children:hover>a {
border: 1px solid #e5e5e5;
border-bottom: none;
background: #fff;
margin-left: -1px;
margin-right: -1px;
margin-top: -1px;
color: #000;
}
.has-children:hover>ul {
border: 1px solid #e5e5e5;
position: relative;
z-index: -1;
}
.has-children:hover>ul>li {
padding: 15px 15px;
}
.has-children>ul>li>a {
text-transform: none;
color: #666;
border-bottom: 1px solid #E5E5E5;
padding: 0;
padding-bottom: 15px;
}
.has-children>ul>li:hover>a {
border-bottom: 2px solid #d00;
color: #000;
padding-bottom: 14px;
}
#media only screen and (min-width:680px) {
nav ul {
flex-direction: row;
}
nav ul li {
position: relative;
flex: 0 0 auto;
text-align: left;
}
nav ul li:hover ul {
display: flex;
flex-direction: column;
}
.has-children ul {
display: none;
position: absolute;
top: 100%;
}
.has-children:hover ul {
display: block;
position: absolute;
top: calc( 100% - 1px);
width: 150%;
}
}
<header class="site-header">
<nav class="site-navigation">
<ul class="site-navigation__list">
<li class="site-navigation__item">Item 1
</li>
<li class="site-navigation__item has-children">Item 2<span class="arrow arrow-down"></span>
<ul class="site-navigation__sub-list">
<li class="site-navigation__sub-item">Subitem 1</li>
<li class="site-navigation__sub-item">Subitem 2</li>
</ul>
</li>
</ul>
</nav>
</header>
<div class="content"><p>Content goes here!</p></div>
Another update maybe to show submenu when parent is hovered ?
.has-children>ul {
display:none;
}
.has-children:hover>ul {
display:block;
}
https://codepen.io/anon/pen/MvKqqE

Centering my webpage tabs

I'm designing a tv show page for my web design class I'm taking.
I added tabs to my web page to be used as top menu following a tutorial, but now I'm not sure how to center the tabs even using the center tag.
body {
font: 0.8em arial, helvetica, sans-serif;
}
#header ul {
list-style: none;
padding: 0;
margin: 0;
}
#header li {
float: right;
border: 1px solid #bbb;
border-bottom-width: 0;
margin: 0;
padding: 0;
}
#header a {
text-decoration: none;
display: block;
background: #eee;
padding: 0.24em 1em;
color: #00c;
width: 8em;
text-align: center;
}
#header a:hover {
background: #ddf;
}
#header #selected {
border-color: black;
}
#header #selected a {
position: relative;
top: 1px;
background: white;
color: black;
font-weight: bold;
}
#content {
border: 1px solid black;
clear: both;
padding: 0 1em;
}
h1 {
margin: 0;
padding: 0 0 1em 0;
}
<div id="header">
<center>
<ul>
<li style="font-family: DFKai-SB;">Home
</li>
<li style="font-family: DFKai-SB;">Shows
</li>
<li style="font-family: DFKai-SB;">Classic
</li>
<li style="font-family: DFKai-SB;">More
</li>
</ul>
</center>
</div>
<div id="content">
</div>
add this div with class .centeer to your tabs instead of <center> :
.centeer {
display: table;
margin: 0px auto 0px auto;
}
Live Demo
The float has more priority so that's why your content floats to one side instead of align. In your css at li elements use some inline variant to avoid stacking.
body {
font: 0.8em arial, helvetica, sans-serif;
}
#header ul {
list-style: none;
padding: 0;
margin: 0;
}
#header li {
display: inline-flex;
border: 1px solid #bbb;
border-bottom-width: 0;
margin: 0;
padding: 0;
}
#header a {
text-decoration: none;
background: #eee;
padding: 0.24em 1em;
color: #00c;
width: 8em;
text-align: center;
}
#header a:hover {
background: #ddf;
}
#header #selected {
border-color: black;
}
#header #selected a {
position: relative;
top: 1px;
background: white;
color: black;
font-weight: bold;
}
#content {
border: 1px solid black;
clear: both;
padding: 0 1em;
}
h1 {
margin: 0;
padding: 0 0 1em 0;
}
<div id="header">
<center>
<ul>
<li style="font-family: DFKai-SB;">Home
</li>
<li style="font-family: DFKai-SB;">Shows
</li>
<li style="font-family: DFKai-SB;">Classic
</li>
<li style="font-family: DFKai-SB;">More
</li>
</ul>
</center>
</div>
<div id="content">
</div>

List (nav) items wont stretch over div that is floated right

I am currently trying to get a horizontal navigation menu to stretch from across the whole of my container.
The div that it is in stretches across fine, but the actual list items don't and I am unsure why.
The CSS for the right hand bar, the container holding the nav bar, and the nav items is:
#rhs{
position: relative;
float: right;
height: 720px;
width: 200px;
background-color: #3D0099;
border-left:2px solid #616161;
}
nav{
display: block;
position: relative;
width: 1010px;
height: 50px;
margin-left: 7px;
background-color: #F0F0F0;
border-top: 1px solid #616161;
border-bottom: 1px solid #616161;
z-index: 99999;
}
nav li{
list-style: none;
display: inline;
margin-left: 10px;
z-index: 99999;
}
The full jsfiddle: http://jsfiddle.net/zDzLs/
Any ideas?
Change css of rhs div to:
#rhs{
position: absolute;
right:0px;
height: 720px;
width: 200px;
background-color: #3D0099;
border-left:2px solid #616161;
}
your code was making my OCD go crazy.
I've revised it a bit for you here. Hope you like it.
http://jsfiddle.net/zDzLs/3/
<header>
<img class="logo" src="images/header.png"/>
<nav>
<ul>
<li class="active">Home</li>
<li>What is Counselling?</li>
<li>Personal Counselling</li>
<li>Relationship Counselling</li>
<li>Supervision of Counsellors</li>
<li>Life Coaching</li>
<li>Contact Me</li>
</ul>
</nav>
</header>
<div class="container">
<div class="content-left"><div class="inner">LEFT</div></div>
<div class="content-right"><div class="inner">RIGHT</div></div>
</div>
* {
padding: 0;
margin: 0;
}
body{
background-color: #F0F0F0;
font: 14px Century Gothic;
}
header {
width: 960px;
margin: 30px auto;
}
header .logo {
width: 300px;
}
nav {
background: #F0F0F0;
margin-top: 30px;
overflow: hidden;
}
nav ul li {
list-style-type: none;
float: left;
margin-right: 2px;
font-size: 12px;
}
nav ul li a {
display: inline-block;
text-decoration: none;
padding: 10px;
background: #333;
color: #fff;
text-align: center;
}
nav ul li a:hover,
nav ul li.active a {
background: #666;
}
.container {
margin: 30px auto 0;
width: 960px; /* 958px */
border:2px solid #616161;
overflow: hidden;
background: #fff;
}
.content-left {
float: left;
width:628px;
margin-right: 30px;
}
.content-right {
float:left;
width: 300px;
background: #f9f9f9
}
.inner {
padding: 20px;
}

Resources