Unable to Center Text using CSS - html

Not sure what I am doing wrong here but I can seem to get some text centered in one of my div's. Ive tried using text-align:center; on the divs, setting width 100% and margin: 0, auto but nothing seems to be working.
Here is the Code and a Fiddle
Thanks
.banner_category { float:left; width:195px; border:solid 1px #b3b3b3; border-radius:3px; margin:0 30px 30px 0; }
.banner_category.ban4, .banner_category.ban8 { margin-right:0; }
.banner_category .banner_img { border-radius:2px; overflow:hidden; }
.banner_category .banner_img img { max-width:100%; }
.banner_category .banner_holder {
padding:12px 2px 13px 2px;
margin: 0 auto;
text-align:center;
overflow:hidden;
background: #f3f3f3; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f3f3f3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(100%, #f3f3f3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%, #f3f3f3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%, #f3f3f3 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%, #f3f3f3 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%, #f3f3f3 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f3f3f3', GradientType=0 ); /* IE6-9 */
border-radius:0 0 2px 2px;
}
.banner_category:hover .banner_holder {
padding:12px 2px 13px 2px;
margin: 0 auto;
text-align:center;
background: #ff9c0e; /* Old browsers */
background: -moz-linear-gradient(top, #ff9c0e 0%, #ff7e06 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ff9c0e), color-stop(100%, #ff7e06)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ff9c0e 0%, #ff7e06 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ff9c0e 0%, #ff7e06 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ff9c0e 0%, #ff7e06 100%); /* IE10+ */
background: linear-gradient(to bottom, #ff9c0e 0%, #ff7e06 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff9c0e', endColorstr='#ff7e06', GradientType=0 ); /* IE6-9 */
}
.banner_category .banner_holder h2 { float:left; margin:0 0 0 0; font-size:14px; font-weight:500; text-transform:uppercase; color:#0a9be0; }
.banner_category .banner_holder i { float:right; margin:1px 0 0 0; font-size:14px; color:#333333; font-style:normal; }
.banner_category:hover .banner_holder h2 { color:#fff; }
.banner_category:hover .banner_holder i {color:#fff; }
<div class="banners_block">
<div class="banner_category ban1">
<a href="{{url=''}}">
<div class="banner_img"><img src="{{url="wysiwyg/image.png"}}" alt="" style="display: block; margin: 0 auto;"/></div>
<div class="banner_holder">
<h2>Center Text</h2>
</div>
</a>
</div>
</div>
http://jsfiddle.net/hzGWk/11/

It's because you h2 is set to float:left. Remove that and it's fine
.banner_category .banner_holder h2 {
/*float: left;*/ //remove
margin: 0 0 0 0;
font-size: 14px;
font-weight: 500;
text-transform: uppercase;
color: #0a9be0;
text-align: center;
}
FIDDLE

remove the float: left; in your line: .banner_category .banner_holder h2 { float:left; margin:0 0 0 0; font-size:14px; font-weight:500; text-transform:uppercase; color:#0a9be0; text-align:center; }.

Related

Flexbox child align-self: flex-end issue in Safari

I'm having some trouble with a flexbox layout in Safari. I have a barchart, aligned using flexbox, but I can't implement it correctly in safari.
Please take a look on my JSfiddle. All advice is welcome! All browsers display it correct, except for Safari.
Fiddle: http://jsfiddle.net/husky999/dq0ha3d5/11/
HTML
<div id="barChart">
<ul class="bars">
<li class="axis">
<div class="level">Ninja</div>
<div class="level">Skilled</div>
<div class="level">Average</div>
<div class="level">Noob</div>
</li>
<li id="tomato" class="eachBar">
<div class="percentage">90<small>%</small>
<div class="skill">HTML5</div></div>
</li>
<li id="pink" class="eachBar">
<div class="percentage">70<small>%</small>
<div class="skill">SASS</div>
</div>
</li>
<li id="yellow" class="eachBar">
<div class="percentage">50<small>%</small>
<div class="skill">JS</div>
</div>
</li>
<li id="aqua" class="eachBar">
<div class="percentage">60<small>%</small>
<div class="skill">JQUERY</div>
</div>
</li>
<li id="apple" class="eachBar">
<div class="percentage">40<small>%</small>
<div class="skill">SYMFONY</div>
</div>
</li>
<li id="khaki" class="eachBar">
<div class="percentage">55<small>%</small>
<div class="skill">OOP</div>
</div>
</li>
</ul>
</div>
CSS
#barChart {
height: 450px;
position: relative;
width: 100%;
background: url(http://2cweb.vn/img/editor-upload/blog/Bo-suu-tap-mau-pattern-cho-thiet-ke-web-P1-2Cwebvn-03.jpg) repeat;
border-bottom: 1px solid #ccc;
}
.bars {
list-style: none;
display: inline;
height: 450px;
display:-webkit-box;
display:-webkit-flex;
display:-webkit-flexbox;
display:flex;
}
.level {
margin: 0 20px 100px 0;
}
.percentage {
position: absolute;
left:0;
right:0;
margin-left:auto;
margin-right:auto;
bottom: 0;
font-family: arial;
font-size: 32pt;
color: #FFF;
opacity: 0.3;
text-align: center;
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.3);
}
.skill {
text-align: center;
color: #fff;
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.3);
font-family: arial;
font-size: 12px;
}
small {
font-size: 14pt;
vertical-align: middle;
}
.eachBar {
position: relative;
width: 15%;
float: left;
margin-left:20px;
visibility: hidden;
display: inline-block;
align-self: flex-end;
opacity: 0;
-webkit-border-radius: 0.3em 0.3em 0 0;
-moz-box-shadow: inset 0 0 1px 0 #FFF;
-webkit-box-shadow: inset 0 0 1px 0 #FFF;
box-shadow: inset 0 0 1px 0 #FFF;
}
.axis {
display: block;
float: left;
border-right: 1px solid #CCC;
}
#tomato {
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ff3019+0,cf0404+100;Red+3D */
background: rgb(255,48,25); /* Old browsers */
background: -moz-linear-gradient(top, rgba(255,48,25,1) 0%, rgba(207,4,4,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,48,25,1)), color-stop(100%,rgba(207,4,4,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,48,25,1) 0%,rgba(207,4,4,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,48,25,1) 0%,rgba(207,4,4,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,48,25,1) 0%,rgba(207,4,4,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,48,25,1) 0%,rgba(207,4,4,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff3019', endColorstr='#cf0404',GradientType=0 ); /* IE6-9 */
border: 1px solid rgba(207,4,4,1);
}
#pink {
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#fb83fa+0,e93cec+100;Pink+3D+%232 */
background: rgb(251,131,250); /* Old browsers */
background: -moz-linear-gradient(top, rgba(251,131,250,1) 0%, rgba(233,60,236,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(251,131,250,1)), color-stop(100%,rgba(233,60,236,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(251,131,250,1) 0%,rgba(233,60,236,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(251,131,250,1) 0%,rgba(233,60,236,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(251,131,250,1) 0%,rgba(233,60,236,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(251,131,250,1) 0%,rgba(233,60,236,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fb83fa', endColorstr='#e93cec',GradientType=0 ); /* IE6-9 */
border: 1px solid rgba(233,60,236,1);
}
#yellow {
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#f1e767+0,feb645+100;Yellow+3D */
background: rgb(241,231,103); /* Old browsers */
background: -moz-linear-gradient(top, rgba(241,231,103,1) 0%, rgba(254,182,69,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(241,231,103,1)), color-stop(100%,rgba(254,182,69,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f1e767', endColorstr='#feb645',GradientType=0 ); /* IE6-9 */
border: 1px solid rgba(254,182,69,1);
}
#aqua {
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#93cede+0,75bdd1+41,49a5bf+100;Blue+3D+%235 */
background: rgb(147,206,222); /* Old browsers */
background: -moz-linear-gradient(top, rgba(147,206,222,1) 0%, rgba(117,189,209,1) 41%, rgba(73,165,191,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(147,206,222,1)), color-stop(41%,rgba(117,189,209,1)), color-stop(100%,rgba(73,165,191,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(147,206,222,1) 0%,rgba(117,189,209,1) 41%,rgba(73,165,191,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(147,206,222,1) 0%,rgba(117,189,209,1) 41%,rgba(73,165,191,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(147,206,222,1) 0%,rgba(117,189,209,1) 41%,rgba(73,165,191,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(147,206,222,1) 0%,rgba(117,189,209,1) 41%,rgba(73,165,191,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#93cede', endColorstr='#49a5bf',GradientType=0 ); /* IE6-9 */
border: 1px solid rgba(73,165,191,1);
}
#apple {
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#d2ff52+0,91e842+100;Neon */
background: rgb(210,255,82); /* Old browsers */
background: -moz-linear-gradient(top, rgba(210,255,82,1) 0%, rgba(145,232,66,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(210,255,82,1)), color-stop(100%,rgba(145,232,66,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(210,255,82,1) 0%,rgba(145,232,66,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(210,255,82,1) 0%,rgba(145,232,66,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(210,255,82,1) 0%,rgba(145,232,66,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(210,255,82,1) 0%,rgba(145,232,66,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d2ff52', endColorstr='#91e842',GradientType=0 ); /* IE6-9 */
border: 1px solid rgba(183,223,45,1);
}
#khaki {
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#d5cea6+0,c9c190+40,b7ad70+100;Brown+3D */
background: rgb(213,206,166); /* Old browsers */
background: -moz-linear-gradient(top, rgba(213,206,166,1) 0%, rgba(201,193,144,1) 40%, rgba(183,173,112,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(213,206,166,1)), color-stop(40%,rgba(201,193,144,1)), color-stop(100%,rgba(183,173,112,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(213,206,166,1) 0%,rgba(201,193,144,1) 40%,rgba(183,173,112,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(213,206,166,1) 0%,rgba(201,193,144,1) 40%,rgba(183,173,112,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(213,206,166,1) 0%,rgba(201,193,144,1) 40%,rgba(183,173,112,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(213,206,166,1) 0%,rgba(201,193,144,1) 40%,rgba(183,173,112,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d5cea6', endColorstr='#b7ad70',GradientType=0 ); /* IE6-9 */
border: 1px solid rgba(183,173,112,1);
}
Javascript
$(document).ready(function() {
$('#tomato').css({'visibility':'visible', 'height': '0%'}).animate({'opacity':'1', 'height':'90%'}, 1000, 'easeOutExpo');
$('#pink').css({'visibility':'visible', 'height': '0%'}).stop().delay(200).animate({'opacity':'1', 'height':'70%'}, 1000, 'easeOutExpo');
$('#yellow').css({'visibility':'visible', 'height': '0%'}).stop().delay(400).animate({'opacity':'1', 'height':'50%'}, 1000, 'easeOutExpo');
$('#aqua').css({'visibility':'visible', 'height': '0%'}).stop().delay(600).animate({'opacity':'1', 'height':'60%'}, 1000, 'easeOutExpo');
$('#apple').css({'visibility':'visible', 'height': '0%'}).stop().delay(800).animate({'opacity':'1', 'height':'40%'}, 1000, 'easeOutExpo');
$('#khaki').css({'visibility':'visible', 'height': '0%'}).stop().delay(1000).animate({'opacity':'1', 'height':'55%'}, 1000, 'easeOutExpo');
});
Thanks, and have nice day/night!
Looks like you included Safari prefixes for the flex container...
.bars {
list-style: none;
display: inline;
height: 450px;
display:-webkit-box;
display:-webkit-flex;
display:-webkit-flexbox;
display:flex;
}
... but you didn't for the flex items (the bars).
Make this adjustment to your CSS:
.eachBar {
position: relative;
width: 15%;
float: left;
margin-left:20px;
visibility: hidden;
display: inline-block;
-webkit-align-self: flex-end; /* add prefixed version */
-ms-flex-item-align: end; /* add prefixed version */
align-self: flex-end;
opacity: 0;
-webkit-border-radius: 0.3em 0.3em 0 0;
-moz-box-shadow: inset 0 0 1px 0 #FFF;
-webkit-box-shadow: inset 0 0 1px 0 #FFF;
box-shadow: inset 0 0 1px 0 #FFF;
}
Revised Demo
Although Safari 9 supports all standard flex properties, with Safari 8 and older you'll need to use vendor prefixes.
For a quick way to add all the prefixes you need, post your CSS in the left panel here: Autoprefixer.
For flexbox browser support details see here: http://caniuse.com/#search=flexbox

Hover effect in nav bar doesn't work as wished

I created a hover effect for my navigation bar / the list inside it. On hover I want to create a "pressed button" effect by applying a box shadow. But the shadow only is casted in a small box. (check picture below)
I want the shadow to fill out the whole navbar around the hovered area.
I have no idea where to put my code and would be glad about any help :)
HTML CODE:
<nav>
<div class="nav-wrapper">
<ul>
<li>Home</li>
<li>Projekte</li>
</ul>
</div>
</nav>
CSS CODE:
html, body {
margin: 0;
padding: 0;
height: 100%;
background-color:white;
font-family: 'Open Sans', sans-serif;
}
.nav-wrapper {
margin: 0 auto;
margin-top: 50px;
width: 60%;
padding-top: 5px;
padding-bottom: 5px;
color:#787878;
box-shadow: 2px 2px 3px #BDBDBD;
border-radius: 5px;
background: #f9f9f9; /* Old browsers */
background: -moz-linear-gradient(top, #f9f9f9 0%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f9f9f9), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f9f9f9 0%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f9f9f9 0%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #f9f9f9 0%,#ededed 100%); /* IE10+ */
background: linear-gradient(to bottom, #f9f9f9 0%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f9f9f9', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
}
ul {
list-style: none;
}
li {
display: inline;
padding: 0 15px;
}
li:hover {
box-shadow: 2px 2px 3px #BDBDBD inset;
}
a {
text-decoration: none;
color:#787878;
}
Add this:
li:hover {
box-shadow: 2px 2px 3px #BDBDBD inset, 2px 2px 3px #BDBDBD;
}
Preview:
Or the bevelled effect here:
li:hover {
box-shadow: 2px 2px 3px #BDBDBD inset, -2px -2px 3px #BDBDBD inset;
}
Preview:
Fiddle: http://jsbin.com/wolotuxico/1/edit?html,css,output
Update from Comments
Remove padding for .nav-wrapper and give it to li
.nav-wrapper {
padding: 0;
}
li {
display: inline-block;
padding: 15px;
}
Preview:
Fiddle: http://jsbin.com/bowawodode/2/edit
Remove the padding from the navigation and add it to the li's. Remember the border is outside the padding and inside the margin.
Example:
https://jsfiddle.net/m98yedk6/1/
.nav-wrapper {
position: relative;
margin: 0 auto;
margin-top: 50px;
width: 60%;
color:#787878;
box-shadow: 2px 2px 3px #BDBDBD;
border-radius: 5px;
background: #f9f9f9; /* Old browsers */
background: -moz-linear-gradient(top, #f9f9f9 0%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f9f9f9), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f9f9f9 0%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f9f9f9 0%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #f9f9f9 0%,#ededed 100%); /* IE10+ */
background: linear-gradient(to bottom, #f9f9f9 0%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f9f9f9', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
}
li {
display: inline-block;
padding: 10px;
}

[CSS]Buttonfrom 3 parts

I want to create button from three images. I use CSS3 with multiple backgrounds.
I need this:
http://i.stack.imgur.com/LxyIQ.png
But I get this:
http://i.stack.imgur.com/5vUHz.png
This is my code:
a.activemenu
{
font-family:"Arial",Arial, serif;
font-size:25px;
text-align:center;
text-decoration:none;
color:white;
background-image:url("buttonleft.png"),url("buttonmid.png"),url("buttonright.png");
background-repeat:no-repeat,repeat-x,no-repeat;
padding:0 33px 62px 33px;
}
What could I be doing wrong?
I create this button using just css without image.
a.activemenu {
background: #931e5b; /* Old browsers */
background: -moz-linear-gradient(top, #931e5b 0%, #3c0c25 100%); /* FF3.6+ */
background:A -webkit-gradient(linear, left top, left bottom, colorQ-stop(0%,#931e5b), color-stop(100%,#3c0c25)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #931e5b 0%,#3c0c25 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #931e5b 0%,#3c0c25 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #931e5b 0%,#3c0c25 100%); /* IE10+ */
background: linear-gradient(to bottom, #931e5b 0%,#3c0c25 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#931e5b', endColorstr='#3c0c25',GradientType=0 ); /* IE6-9 */
border:0px;
font-family:"Arial",Arial, serif;
font-size:25px;
text-align:center;
padding:10px;
border-radius: 0px 0px 10px 10px;
color:#fff;
text-decoration:none;
}
http://jsfiddle.net/parslook/LhMWn/2/
Try this:
background: url(buttonleft.png) left bottom no-repeat,
url(buttonmid.png) left bottom repeat-x,
url(buttonright.png) right bottom no-repeat;
Ref. http://www.css3.info/preview/multiple-backgrounds/
If you're using CSS3 (as mentioned in your tags), you could simplify it by using some gradients and border-radius.
a.activemenu {
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
font-family: arial, sans-serif;
color: #fff;
text-decoration: none;
text-align: center;
padding: 10px 33px;
background: #931e5b;
background: -webkit-linear-gradient(bottom, #3e0c26, #931e5b);
background: -moz-linear-gradient(bottom, #3e0c26, #931e5b);
background: -ms-linear-gradient(bottom, #3e0c26, #931e5b);
background: -o-linear-gradient(bottom, #3e0c26, #931e5b);
background: linear-gradient(bottom, #3e0c26, #931e5b);
}
See this fiddle: http://jsfiddle.net/LcW6K/

Background not coming in ie8

When I put the navigation background image is not coming in ie8 ie7. all other browsers are ok. I Have added the code below . Can anyone please help me to fix this is issue?/
<nav class="navigation">
<ul>
<li><a href="http://www.ticketstosrilanka.co.uk/" >Home</a></li>
<li>Flights</li>
<li>Travel Guide</li>
<li>Tours & Holidays</li>
<li>About us</li>
<li>Contact Us</li>
</ul>
</nav>
.navigation {
margin: 0px 0;
font: bold 12px/18px "Helvetica Neue", Helvetica, Arial, sans-serif;
text-transform: uppercase;
color: #444;
width:100%;
background: url("../images/menubg.png")repeat-x scroll left top transparent;
-webkit-box-shadow: 0 1px rgba(255,255,255,1) inset;
}
.navigation:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
.navigation ul {
float: left;
border-radius: 0px;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.07);
-webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.07);
overflow: hidden;
}
.navigation li {
float: left;
border-style: solid;
border-width: 1px;
border-color: #BABABA #BABABA #BABABA #FFF;
box-shadow: 0 1px rgba(255,255,255,1) inset;
-webkit-box-shadow: 0 1px rgba(255,255,255,1) inset;
background: #F7F7F7; /* Old browsers */
background: -moz-linear-gradient(top, #F7F7F7 0%, #EDEDED 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F7F7F7), color-stop(100%,#EDEDED)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #F7F7F7 0%,#EDEDED 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #F7F7F7 0%,#EDEDED 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #F7F7F7 0%,#EDEDED 100%); /* IE10+ */
background: linear-gradient(top, #F7F7F7 0%,#EDEDED 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F7F7F7', endColorstr='#EDEDED',GradientType=0 ); /* IE6-9 */
}
.navigation li:hover, navigation li.current {
box-shadow: 0 1px rgba(255,255,255,0.2) inset;
-webkit-box-shadow: 0 1px rgba(255,255,255,0.2) inset;
border-color: #262626 !important;
background: #4D4D4D; /* Old browsers */
background: -moz-linear-gradient(top, #4D4D4D 0%, #262626 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4D4D4D), color-stop(100%,#262626)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #4D4D4D 0%,#262626 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #4D4D4D 0%,#262626 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #4D4D4D 0%,#262626 100%); /* IE10+ */
background: linear-gradient(top, #4D4D4D 0%,#262626 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4D4D4D', endColorstr='#262626',GradientType=0 ); /* IE6-9 */
}
.navigation a {
display: block;
padding: 10px 15px;
color: #444;
text-decoration: none;
text-shadow: 0 1px #FFF;
}
.navigation a.active{
box-shadow: 0 1px rgba(255,255,255,0.2) inset;
-webkit-box-shadow: 0 1px rgba(255,255,255,0.2) inset;
border-color: #262626 !important;
background: #4D4D4D; /* Old browsers */
background: -moz-linear-gradient(top, #4D4D4D 0%, #262626 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4D4D4D), color-stop(100%,#262626)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #4D4D4D 0%,#262626 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #4D4D4D 0%,#262626 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #4D4D4D 0%,#262626 100%); /* IE10+ */
background: linear-gradient(top, #4D4D4D 0%,#262626 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4D4D4D', endColorstr='#262626',GradientType=0 ); /* IE6-9 */
color:#fff;
}
.navigation a:hover, #navigation li.current a {
color: #FFF;
text-shadow: 0 1px #000;
}
.navigation li:first-child {
border-left-color: #BABABA;
border-radius: 0px 0 0 0px;
}
.navigation li:last-child {
border-radius: 0 0px 0px 0;
}
Just add float: left; to your .navigation this may solve your problem, if not , try by adding
* html .navigation{height: 1%;}
Now add this
.navigation {
background: url("../images/menubg.png") repeat-x left top; // add this line
background: url("../images/menubg.png")repeat-x scroll left top transparent; // remove this line
}
Live demo

How to make triangle shape in before a div in pure css?

Hello friends I have tried many times but I am not successful than please help me
I want to this below images as like this
now i have created this but not created right corner of this div now any body please help me
my code is
Css
.dashbord a {
display:block;
line-height:28px;
padding-left:8px;
font-family: 'LatoRegular';
font-size:14px;
color:#58544e;
max-width:300px;
text-shadow:1px 0 0 rgba(241,236,231,1);
}
.dashbord .active{
background: #b43720; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMTAwJSIgeDI9IjEwMCUiIHkyPSIwJSI+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjYjQzNzIwIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2U5NDU0MSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(90deg, #b43720 0%, #e94541 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#b43720), color-stop(100%,#e94541)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(90deg, #b43720 0%,#e94541 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(90deg, #b43720 0%,#e94541 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(90deg, #b43720 0%,#e94541 100%); /* IE10+ */
background: linear-gradient(90deg, #b43720 0%,#e94541 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b43720', endColorstr='#e94541',GradientType=1 ); /* IE6-8 fallback on horizontal gradient */
box-shadow:1px 0 0 0 rgba(230,227,223,1), 0px -3px 0 0 rgba(153,40,19,1) inset;
text-shadow:1px 0 0 rgba(153,40,19,1);
color:#fff;
border-radius:5px 0 0 5px;
line-height:30px;
position:relative;
margin-left:-4px;
}
.dashbord .active:after{
content:'';
position:absolute;
right:-9px;
top:0;
bottom:0;
border-bottom: 15px solid transparent;
border-left: 9px solid #b43720;
border-top: 15px solid transparent;
}
HTML
<div class="dashbord">
Co-Workers
</div>
Jsfiddle link here http://jsfiddle.net/TBB9S/
Write like this:
.dashbord .active:after{
content:'';
position:absolute;
right:-11px;
top:3px;
z-index:-1;
width:22px;
height:22px;
background:green;
-moz-transform:rotate(45deg);
-webkit-transform:rotate(45deg);
transform:rotate(45deg);
box-shadow:-3px 0 0 0 rgba(153,40,19,1) inset;
background: -moz-linear-gradient(left top, #e94541 0%,#b43720 100%);
background: -webkit-linear-gradient(left top, #e94541 0%,#b43720 100%);
background: linear-gradient(left top, #e94541 0%,#b43720 100%);
}
Check this http://jsfiddle.net/TBB9S/2/