Equal Spacing in Navbar - css

I've made a "Sticky Navbar using CSS and HTML5 and I have 4 links to place on the navbar but I can't get them to space themselves Equally now before you say this is a duplicate and all, but first of all none of the solutions worked for me and second, I have a logo in the middle of the navbar... Some help Please!heres my website: catsonfire.tk
<style>
article {
margin: auto;
height:auto;
padding-bottom:10px;
}
header {
margin: auto;
width: 100%;
position: relative;
top: 16px;
height: 60px;
}
footer {
background-color: wheat;
align-content: center;
margin: auto;
width:100%
}
nav {
position: relative;
width: 100%;
}
#header_container ul {
margin: 0;
padding: 0px;
list-style-type: none;
text-align: center;
}
#main {
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
#header_container ul li {
display: inline;
width: 25%;
margin:0;
padding:0;
}
#header_container ul li a {
text-decoration: none;
padding: 39px;
color: #fff;
padding: 12px 0 13px 0;
}
#header_container ul li a:hover {
color: #000;
background-color: rgba(0, 0, 0, 0.7);
box-shadow: 1px 1px 1px inset;
-moz-box-shadow: 1px 1px 1px inset;
-webkit-box-shadow: 1px 1px 1px inset;
}
#big {
background: rgba(0, 0, 0, 0.5);
top: 0px;
left: 0px;
right: 0px;
margin: 0px;
width: 100%;
position: absolute;
height: 105px;
}
#header_container {
left: 0;
position: fixed;
width: 100%;
top: 0;
z-index:1000;
height:150px
}
#header {
line-height: 60px;
margin: 0 auto;
}
</style>
Home
About

Your site shows two links, but some thoughts:
#big ul{
display:block;
}
#big li {
display:block;
width:25%;
float:left;
text-align:center;
}
#big li a{
display:inline-block;
}
Makes the li element 1/4th of the width of its parent ul, then centers each a element in those. Add your styles as you want it to look.

Related

How to Center align Menu in Twenty ten default WordPress theme?

IS it possible to align menu item center? Actually my website has a lot many menus, So menus are appearing on second line from left so I want to show them as center aligned.Any suggestions?
Please find below my Css. This is edited style sheet of default twenty ten wordpress theme. I am using full width layout.
Thanks.
#access {
background:#cc0000;
margin: 0 auto;
width: 100%;
padding: 0px 0px;
border-top:2px solid #eb9999;
border-bottom:12px solid #000000;
clear:both;
margin-bottom:5px;
}
#access .menu-header,
div.menu {
font-size: 13px;
margin: 0 auto;
width: 1024px;
}
#access .menu-header ul,
div.menu ul {
list-style: none;
margin: 0;
}
#access .menu-header li,
div.menu li {
float: left;
position: relative;
}
#access a {
color: #aaa;
display: block;
line-height: 20px;
padding: 0 10px;
text-decoration: none;
}
#access ul{display:inline-block;}
#access ul ul {
box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0px 3px 3px rgba(0,0,0,0.2);
display: none;
position: absolute;
top: 38px;
left: 0;
float: left;
width: 180px;
z-index: 99999;
}
#access ul ul li {
min-width: 180px;
}
#access ul ul ul {
left: 100%;
top: 0;
}
#access ul ul a {
background: #333;
line-height: 1em;
padding: 10px;
width: 160px;
height: auto;
}

Creating space between Side Buttons

I'm trying to create a space down the left hand side of my page for social media buttons, my problem is the buttons will not spread apart to where there is a large enough gap between buttons.
enter image description here
body {
background: darkgrey;
background-image:url('../https://www.dropbox.com/home?preview=city.jpg');
font-family: arial;
}
#wrapper {
width: 800px;
margin: 100px auto 0 auto;
padding-bottom: 20px;
}
#header {
width: 800;
height: auto;
margin: 0;
background: transparent;
}
.logo{
text-align: center;
}
#tabs{
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
}
#tabs li{
float: left;
margin: 0 .5em 0 0;
}
#tabs a{
position: relative;
background: #ddd;
background-image: linear-gradient(to bottom, #ccc, #ddd);
padding: .7em 3.5em;
float: left;
text-decoration: none;
color: #444;
text-shadow: 0 1px 0 rgba(255,255,255,.8);
border-radius: 5px 0 0 0;
box-shadow: 0 2px 2px rgba(0,0,0,.4);
}
#tabs a:hover,
#tabs a:hover::after,
#tabs a:focus,
#tabs a:focus::after{
background: #fff;
}
#tabs a:focus{
outline: 0;
}
#tabs a::after{
content:'';
position:absolute;
z-index: 1;
top: 0;
right: -.5em;
bottom: 0;
width: 1em;
background: #ddd;
background-image: linear-gradient(to bottom, #ccc, #ddd);
box-shadow: 2px 2px 2px rgba(0,0,0,.4);
transform: skew(10deg);
border-radius: 0 5px 0 0;
}
#tabs #current a,
#tabs #current a::after{
background: #fff;
z-index: 3;
}
#content
{
background: #fff;
padding: 2em;
height: 520px;
position: relative;
z-index: 2;
border-radius: 0 5px 5px 5px;
box-shadow: 0 -2px 3px -2px rgba(0, 0, 0, .5);
}
p {text-align:left;
line-height:120%;
margin-right: 2cm;
letter-spacing: 0px;
}
#icons {
position: absolute;
top: 86px;
left: -90px;
z-index: 3;
}
table {border: solid darkgrey thin;
}
}
footer {
display: inline-block;
width:800px;
text-align: left;
margin-top: 250px;
}
footer ul {list-style-type: none;
text-align: center;
float: left;
}
footer li {display:inline;
margin-left: 20px;
}
footer a:link{
text-decoration: none;
}
footer p {
float:right;
}
.menu {
word-spacing: 10px;
}

my drop down menu disappears before i can click on it

the drop down menu disappears before you can click on a link. i thought it was a confict with the slider but even if i get rid of it i still have the issue. the site is tourismreddeer.com
here is the html:
<ul class="headerNav">
<a class="btnHome" href="/"><span>Home</span></a>
<li>About Red Deer<img src="/images/link_photo_about.png" width="81" height="81" />
</li>
<li>Events & Attractions<img src="/images/link_photo_events.png" width="81" height="81" />
<ul class="sub-menu sub-events">
<li>Red Deer & Area Events</li>
<li>Business Listings</li>
<li>Mud Hero</li>
</ul>
</li>
<li>Plan Your Trip<img src="/images/link_photo_holiday.png" width="81" height="81" /></li>
<li>Places to Stay<img src="/images/link_photo_accommodations.png" width="81" height="81" /></li>
<li>Meetings & Sports<img src="/images/link_photo_sports.png" width="81" height="81" /></li>
and this is the css:
.btnHome {
position: absolute;
top: 30px !important;
left: 0px;
width: 200px;
height: 115px;
background-image: url(../images/spacer.gif);
}
.header {
position: relative;
top: 0px;
width: 986px;
height: 148px;
background-repeat: no-repeat;
background-position: 0px 95px;
}
.header ul {
font-family: 'PT Sans Narrow', arial, serif;
color: #fff;
font-size: 17px;
list-style: none;
margin: 0px;
padding: 0px;
}
.header a {
color: #fff;
}
.header ul a {
position: absolute;
top: 111px;
}
.linkGreen {
left: 242px;
}
.linkBlue {
left: 395px;
}
.linkPurple {
left: 545px;
}
.linkBrown {
left: 695px;
}
.linkYellow {
left: 843px;
}
.header ul a img {
position: absolute;
top: -78px;
left: 14px;
}
.headerLinks {
position: absolute;
top: 0px;
right: 0px;
font-family: 'PT Sans Narrow', arial, serif;
color: #fff;
font-size: 14px;
width: 320px;
height: 28px;
padding: 7px 0px 0px 0px;
}
.headerLinks a {
padding: 0px 4px 0px 4px;
}
.headerLinkConsumer {
position: absolute;
top: 0px;
right: 83px;
width: 86px;
height: 34px;
background-image: url(../images/link_header_consumer_lo.png);
background-repeat: no-repeat;
}
.headerLinkConsumer:hover, .headerLinkConsumer.current {
background-image: url(../images/link_header_consumer.png);
}
.headerLinkIndustry {
position: absolute;
top: 0px;
right: -3px;
width: 86px;
height: 34px;
background-image: url(../images/link_header_industry_lo.png);
background-repeat: no-repeat;
}
.headerLinkIndustry:hover, .headerLinkIndustry.current {
background-image: url(../images/link_header_industry.png);
}
.headerShadow {
position: absolute;
right: 0px;
top: 95px;
}
.headerLogo {
position: absolute;
left: 0px;
top: 27px;
}
.headerLogoSide {
position: absolute;
left: -24px;
top: 43px;
}
ul.headerNav ul {display: none;}
ul.headerNav li:hover > ul {
display: block;}
ul.headerNav li a:hover > ul li {
display: block;}
ul.headerNav li:hover > ul.sub-events {
margin: 148px 0 0 375px;}
.headerNav .sub-menu {
position:absolute;
z-index:12000;
display:none;
background:#999999 !important;
padding:5px 15px;
-webkit-box-shadow:1px 1px 2px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow:1px 1px 2px 0px rgba(0, 0, 0, 0.2);
box-shadow:1px 1px 2px 0px rgba(0, 0, 0, 0.2);
-webkit-border-radius:0px 0px 3px 3px;
-moz-border-radius:0px 0px 3px 3px;
border-radius:0px 0px 3px 3px;
border-top:3px solid #555555;
}
.headerNav .sub-menu li {
display: block !important;
margin: 0 !important;
padding: 0 !important;
height: auto !important;
border-bottom: 1px solid #a5a5a5;
border-left: none !important;
}
.headerNav .sub-menu li a{
height: auto !important;
line-height: 1 !important;
padding:10px 0 !important;
}
html body .headerNav .sub-menu li a,
html body .headerNav .sub-menu li .sub-menu li a,
html body .headerNav .sub-menu li .sub-menu li .sub-menu li a {
border: none !important;
display: block !important;
width: 160px;
margin: 0 !important;
padding: 8px 0px !important;
color: #dedede;
line-height: normal;
font-weight: normal !important;
height: auto;
background: none !important;
position:inherit;
}
.headerNav .sub-menu li a:hover,
.headerNav .sub-menu li .sub-menu li a:hover,
.headerNav .sub-menu li.current-menu-item a,
.headerNav .sub-menu li.current-menu-item a:hover,
.headerNav .sub-menu li.current_page_item a,
.headerNav .sub-menu li.current_page_item a:hover {
color: #ffffff !important;
font-weight: normal;
}
.headerNav .sub-menu li:last-child{
border: none;
}
.headerNav .sub-menu li ul {
top: -1px !important;
left: 178px !important;
border-top: none;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
}
You have some pretty weird stuff going on inside your CSS. The actual menu bar is sitting up above the web page and the text from them is hanging down using absolute positioning and offsets. I'm not going to bang on about how you should redo a lot of this CSS because you probably know that and you came here for a solution. Here's what I managed:
It's not perfect but it's a tough piece to work with:
Change this selector like so:
.header ul a {
position: absolute;
top: 111px;
padding-bottom:20px; /* <-- this is the new bit */
}
This will mean your link text will hold its 'hover' status until the cursor crosses over onto the menu, kinda using the padding as a "bridge".
Again, this is a quick and dirty fix and I strongly suggest a larger-scale re-work but if you have deadlines, such is life.

CSS ribbon menu causing gap between content and header

I am not sure how to remove the large gap between my header and the beginning of the slideshow. pivotalpixels.com/colusa_fair/ I believe that the problem is something to do with the ribbon navigation but after trying tons of different things I do not know how to move the content up without the recent news moving up to right underneath the navigation bar, which needs to be under the slideshow as it currently is.
css is below
Thanks I appreciate any help!
#charset "utf-8";
/* CSS Document */
body {
margin:0px;
padding:0px;
background-color:#c4c0be;
background-image:url(../images/bluewoodbkgd.jpg);
margin:0px; padding:0px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
color:#7f7d78;
font-size:13px;
line-height:19px;
}
h1{}
h2 {
margin:0px 0px 10px 0px;
font-size:36px;
font-family:Helvetica, Arial, Sans-serif;
color:#000000;
font-weight: bold;
}
h3{font-size:16px; color: #142b4e; font-weight: bold;}
small {
color:#595856;
font-weight:bold;
font-size:11px;
display:block;
margin-bottom:15px;
}
a {
color:#007de2;
text-decoration:none;
}
a:hover { text-decoration:underline; }
p { margin: 0px 0px 15px 0px; }
#main {
min-height: 500px;
}
#footer {
color:white;
}
.container {
width:994px;
margin:0 auto;
}
#header {
padding-top:10px;
margin: 0;
}
#logo h1 {
margin:0px;
display:block;
text-indent:-9999px;
}
/* Fix up IE6 PNG Support */
img, #logo { behavior: url(scripts/iepngfix.htc); }
#logo {
position: absolute;
top:-25px;
background-image:url(../images/logo_colusa.png);
background-repeat:no-repeat;
margin: 0 0 0 25px;
width:240px;
height:147px;
}
#navigation_container {
width: 994px;
margin: 0;
}
ul#menu{
margin: 0;
top:10px;
position: absolute;
left: 300px;
}
ul#menu li {
list-style: none;
float: left;
display: inline;
}
ul#menu li a {
text-shadow: 0 2px 1px rgba(0,0,0,0.5);
text-decoration: none;
margin: 0 10px 0 0;
color:#FFF;
font: 18px/27px 'ArvoRegular', Arial, sans-serif;
line-height: 28px;
}
ul#menu li a.active, ul#menu li a:hover {
color:#5a8c35;
text-decoration: underline;
margin-top: 2px;
}
.rectangle {
background: #142b4e;
height: 52px;
position: relative;
-moz-box-shadow: 0px 0px 4px rgba(0,0,0,0.55);
-webkit-box-shadow: 0px 0px 4px rgba(0,0,0,0.55);
box-shadow: 0px 0px 4px rgba(0,0,0,0.55);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
z-index: 500; /* the stack order: foreground */
margin: 35px 0 0 0;
}
.l-triangle-top {
border-color: #142b4e transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: left;
top: 0px;
left: -50px;
}
.l-triangle-bottom {
border-color: transparent transparent #142b4e;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: left;
top: -49px;
left: -150px;
}
.r-triangle-top {
border-color: #142b4e transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: right;
right: -45px;
top: -50px;
}
.r-triangle-bottom {
border-color: transparent transparent #142b4e;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: right;
top: -100px;
right: -145px;
}
#sec_navigation_container {
width: 600px;
margin: 0 0 0 255px;
}
ul#menu_sec{
margin: 0;
top:10px;
position: absolute;
left: 110px;
}
ul#menu_sec li {
list-style: none;
float: left;
display: inline;
}
ul#menu_sec li a {
text-shadow: 0 2px 1px rgba(0,0,0,0.5);
text-decoration: none;
margin: 0 10px 0 0;
color:#FFF;
font: 18px/27px 'ArvoRegular', Arial, sans-serif;
line-height: 28px;
}
ul#menu_sec li a.active, ul#menu_sec li a:hover {
color:#ce6536;
text-decoration: underline;
margin-top: 2px;
}
.rectangle_mainsec {
background: #ce6536;
height: 52px;
position: relative;
z-index: 500; /* the stack order: foreground */
margin: 0;
}
.l-triangle-top-sec {
border-color: #ce6536 transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: left;
top: 0px;
left: -50px;
}
.l-triangle-bottom-sec {
border-color: transparent transparent #ce6536;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: left;
top: -49px;
left: -150px;
}
.r-triangle-top-sec {
border-color: #ce6536 transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: right;
right: -125px;
top: -53px;
}
.r-triangle-bottom-sec {
border-color: transparent transparent #ce6536;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: right;
top: -100px;
right: -225px;
}
/*
Block-Styles
*/
.block {
margin-bottom:20px;
}
.block_inside {
padding:0 20px;
}
.image_block {
border:1px solid #557f9d;
background-color:#ffffff;
padding:5px;
float:left;
}
.image_block img {
border:1px solid #b5b5b5;
}
#block_slideshow{
overflow: hidden;
width: 100%;
}
.upcoming_events {
float:left;
width:315px;
height: 325px;
margin-left:30px;
padding: 10px;
border: 1px solid #557f9d;
background-color:#ffffff;
}
.upcoming_events h2, #event_items h2{
position: relative;
width: 90%;
font: 24px/27px 'DancingScriptOTRegular', Arial, sans-serif;
padding: 6px 20px 6px 30px;
margin: 4px 10px 10px -31px;
color: #fff;
background-color: #5a8c35;
text-shadow: 0px 1px 2px #7c7c7c;
-webkit-box-shadow: 0px 2px 2px 0px #295e04;
-moz-box-shadow: 0px 2px 2px 0px #295e04;
box-shadow: 0px 2px 1px 0px #295e04;
border: 1px solid #295e04;
}
.upcoming_events h2:before, #event_items h2:before
{
content: ' ';
position: absolute;
width: 0;
height: 0;
right: -2px;
top: 0px;
border-style: solid;
border-width:20px;
border-color: transparent #fff transparent transparent;
}
.upcoming_events h2:after, #event_items h2:after{
content: ' ';
position: absolute;
width: 0;
height: 0;
left: 0px;
top: 100%;
border-width: 5px 10px;
border-style: solid;
border-color: #295e04 #295e04 transparent transparent;
}
.block_content{ padding: 10px;}
#block_recent{overflow:auto;
margin-bottom:20px; }
#event_items {
width:560px;
margin-right:25px;
margin-left: 20px;
float:left;
padding: 10px;
border: 1px solid #557f9d;
background-color:#ffffff;
}
#countdown {
float:right;
width:332px;
height: 175px;
margin-right: 20px;
margin-bottom:20px;
background-image: url(../images/countdown.png);
background-repeat:no-repeat;
}
#block_right {
float:right;
width:332px;
height: 175px;
margin-right: 20px;
margin-bottom: 20px;
background-image: url(../images/countdown.png);
background-repeat:no-repeat;
}
.mini_event_item {
width: 48%;
margin: 5px 0px 10px 10px;
float: left;
}
.date{color: #5a8c35; font-weight: bold;}
.mini_event_item .block_inside {
padding:25px 30px 15px 30px;
}
.mini_event_item .thumbnail { float:left; margin-right:20px; border:1px solid #979390; }
#sponsors{margin: 10px 0px; padding: 10px; height: 95px; background-color: #142b4e; }
.sponsor_item,footer_item{float: left; margin-right: 10px; padding: 10px; height: 70px; background-color: #ffffff; border: 1px solid #000;}
#footer {
font: 18px/27px 'ArvoRegular', Arial, sans-serif;
}
.footer_column {
float:left;
width:300px;
margin-right:10px;
}
#footer .long {
width:670px;
}
#footer h3 {
color:#fff;
text-shadow: 1px 1px 1px #000;
}
#footer h4{
font-size: 16px;
text-shadow: 1px 1px 1px #000;
}
#footer p{ font-size: 12px;
}
ul.industry_links{
padding: 10px;
display: inline;
}
ul.industry_links li {
float:left;
list-style:none;
text-align: center;
}
ul.industry_links li a{
display:block;
width: 135px;
height: 79px;
margin-right: 10px;
padding: 10px;
background-color: #ffffff;
border: 1px solid #039;
text-align: center;
}
.footer_column ul li, .footer_column ul {
list-style:none;
margin:0px;
padding:0px;
font-size: 12px;
}
The r-triangle-top-sec and r-triangle-bottom-sec elements that generate the "ribbon" effect are using the "CSS Triangle Trick" which requires a large border size (50px in this case).
This is causing a lot of extra height due to the invisible border rendering.
One quick fix is to position:absolute these elements.
First, make the container position:relative so the child elements will use it as a positioning reference point
#sec_navigation_container{
position:relative /* Add */
/*...*/
}
Add this to r-triange-top-sec
position: absolute;
top: 0;
right: -50px;
Add this to r-triange-bottom-sec
position: absolute;
top: -50px;
right: -50px;
That should get rid of some of that spacing. Applying this idea to the upper "ribbon" might help as well.
UPDATE
Turns out, the exact same code can be used for the blue ribbon as well. Rinse/repeate the above code but for #navigation_container, l-triangle-top and l-triangle-bottom.
That will move your "slideshow" content flush to the navigation.
You can then add some margin to your #header element such as:
margin-bottom:2em;
to push that "slideshow" back down to a desired separation. (adjust the valid as desired)
note I just eyeballed the placement of the ribbon. Please adjust top/right position as needed for your design
I hope that helps!

Wrapper not to go from top to bottom

Ok, I give up - I can't work it out; the wrapper seems to go from the top to the bottom while I want it to leave a gap at the top and bottom so the background appears through. I can't seem to work it out. I am very novice to this. Any help & ideas very welcome.
Code
body {
background: #ffffff url(bgfin.jpg) repeat;
font-family: Tahoma,arial, sans-serif;
font-size:12px;
color:#666666;
height: 100%;
margin:0;
padding:0;
}
#wrapper {
background: url(body-line.png) center repeat-y;
padding-top: 65px;
padding-bottom: 65px;
}
#wrappertop{
background: url(header.png) top center no-repeat;
}
#wrappertbtm{
background: url(footer-new.png) bottom center no-repeat;
padding-bottom: 65px;
}
#container{
width: 959px;
margin: 0 auto;
}
.title{
width: 959px;
height: 56px;
padding: 15px 0px 10px 0px;
font-size: 30px;
color: #bd7821;
}
#navigation{
position: relative;
width: 959px;
height: 40px;
z-index: 2;
}
#navigation li{
float: left;
z-index: 2;
padding: 0px 34px 0px 0px;
}
#navigation li a{
display: inline-block;
position: relative;
outline: none;
height: 28px;
color: #e3e3e3;
z-index: 2;
font-size: 12px;
padding: 15px 0px 0px 0px;
text-decoration: none;
}
#navigation li a:hover, #navigation li#active a{
color: #bd7821;
text-decoration: none;
}
#header{
position: relative;
width: 959px;
height: 196px;
z-index: 1;
margin: 20px 0px 0px 0px;
}
Try:
body { padding:20px 0; }
Or:
#wrapper { margin:20px 0; }
That is shorthand for:
#wrapper {
margin-top:20px;
margin-right:0;
margin-bottom:20px;
margin-left:0;
}
Remember:
Padding is rendered inside of the element
Margin is on the outside
This might help as a reminder:
How to remember in CSS that margin is outside the border, and padding inside

Resources