Working with CSS3 Menu - html

I am presently doing a project with menus and trying to implement something which is the same menu appeared below:
And now I have got which is similar to this menu and trying to modify it but I am stucked with it.
Here is the screenshot of my menu how it looks in chrome:
And this is how it looks in IE8 and firefox:
The problem is I am able to get rounded corners but the gloss and the bump over the menu which is shown in 1st menu is not appearing in my menu as it is showing as flat in chrome,IE as well as firefox.So how do I modify in order to get the same menu as shown in 1st figure.
Here is my menu css:
.menu
{
height: 18px;
margin-left:318px;
margin-top:10px;
width:914px;
border: 1px solid #d6d6d6;
background: #fff;
padding: 14px;
text-align: center;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: #1612CE;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#1612CE), to(#3B91F1));
background: -webkit-linear-gradient(#1612CE, #3B91F1);
background: -moz-linear-gradient(#1612CE, #3B91F1);
background: -ms-linear-gradient(#1612CE, #3B91F1);
background: -o-linear-gradient(#1612CE, #3B91F1);
background: linear-gradient(#1612CE, #3B91F1);
behavior: url(css/ie-css3.htc);
}
.blue {
background : rgb(52,119,210);
background : -webkit-gradient(linear, left top, left bottom, from(rgb(52,119,210)), to(rgb(34,98,188)));
background : -moz-gradient(linear, left top, left bottom, from(rgb(52,119,210)), to(rgb(34,98,188)));
border: 1px solid #2f8893;
}
.blue li a
{
color: #fff;
text-shadow: 0 -1px 0 rgba(0,0,0,.40);
}
a {
text-decoration: none;
color: #262626;
line-height: 20px;
}
ul
{
margin: 0;
padding: 0;
z-index: 300;
text-align:right;
}
li
{
padding: 0 10px;
display:inline-block;
}
li:first-child {
float:left;
}
This is how I'm showing it:
<div class="menu blue">
<ul >
<li class="active">Home</li>
<li>About</li>
<li>Blog</li>
<li>Services</li>
<li>Portfolio</li>
<li>Contacts</li>
<li>Back to Article</li>
<li>How it Works?</li>
</ul>
</div>

Try this combination of colors: http://jsfiddle.net/TLS3Y/4/
CSS3 Please! makes all these CSS3 rules so easy :)
.menu {
border-color: #598FD1 #598FD1 #1A53A2;
border-style: solid;
border-width: 2px 1px 3px;
height: 18px;
margin-left: 318px;
margin-top: 10px;
padding: 14px;
text-align: center;
width: 914px;
background-color: #2A72D8;
background-image: -webkit-gradient(linear, left top, left bottom, from(#2A72D8), to(#1A53A2));
background-image: -webkit-linear-gradient(top, #2A72D8, #1A53A2);
background-image: -moz-linear-gradient(top, #2A72D8, #1A53A2);
background-image: -ms-linear-gradient(top, #2A72D8, #1A53A2);
background-image: -o-linear-gradient(top, #2A72D8, #1A53A2);
background-image: linear-gradient(top, #2A72D8, #1A53A2);
-webkit-box-shadow: inset 0px 0px 9px #2A72D8;
-moz-box-shadow: inset 0px 0px 9px #2A72D8;
box-shadow: inset 0px 0px 9px #2A72D8;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
behavior: url(css/ie-css3.htc);
}

First of all i encourage you to use Lea Verou's http://leaverou.github.com/prefixfree/ which saves you the pain of having to add all those prefixes for different browsers and makes just one linear-gradient declaration
Second you are not using the proper declarations for linear-gradient in webkit. Should be
-webkit-linear-gradient(rgb(52,119,210),rgb(34,98,188))
This is the shorthand method which you should use since you are not specifying any angles for your gradient
This is also available in FF
background: -moz-linear-gradient(rgb(52,119,210),rgb(34,98,188)); /* Firefox */
background: -webkit-linear-gradient(rgb(52,119,210),rgb(34,98,188)); /* Webkit */
For a 3d-er look add box-shadow set on inset
box-shadow:inset 0 1px 0 #fff; // for a nice thing white line at the top of the menu
You can also chain the box-shadow declarations and have
box-shadow:inset 0 1px 0 #fff, 0 2px 5px #222 // thing white line at the top and drop shadow

You can emboss the ul using box-shadow:
div.blue {
box-shadow: 2px 2px 2px #888888;
}
Gradient can be made with linear-gradient. I like the generator at http://gradients.glrzad.com/.

Related

Button Active focus shadow default problem

The top of the button seems to have a default shadow when clicked you can see in the Codepen example the gold border gets darker around the top rim - how do I remove this behaviour?
Example
.button {
cursor:pointer;
height: 3rem;
width:10rem;
margin:15px;
font-size:2em;
font-family: Helvetica, Arial, Sans-Serif;
background: linear-gradient(to bottom, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 9%,rgba(102,102,102,1) 20%,rgba(71,71,71,1) 34%,rgba(71,71,71,1) 34%,rgba(44,44,44,1) 45%,rgba(0,0,0,1) 54%,rgba(17,17,17,1) 60%,rgba(43,43,43,1) 76%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%);
text-decoration:none;
border-radius:10rem;
border-color:#fcbd3f ;
border-width: 1.5px;
color:#d4d6d8 ;
box-shadow: 0px 17px 10px -10px rgba(0,0,0,0.4);
outline: none;
&:active{
outline: none;
box-shadow: inset 0px 7px 10px -10px;
background: linear-gradient(to bottom, rgba(76,76,76,1) 0%,rgba(0,0,0,1) 16%,rgba(17,17,17,1) 51%,rgba(28,28,28,1) 70%,rgba(28,28,28,1) 70%,rgba(44,44,44,1) 82%,rgba(43,43,43,1) 82%,rgba(56,56,56,1) 82%,rgba(44,44,44,1) 82%,rgba(66,66,66,1) 84%,rgba(84,84,84,1) 91%,rgba(109,109,109,1) 92%,rgba(102,102,102,1) 98%,rgba(28,28,28,1) 100%,rgba(19,19,19,1) 100%);
}
&:hover{
color: white;
outline: none;
}
}
button:active{
outline: none;
box-shadow: inset 0px 7px 10px -10px;
background: linear-gradient(to bottom, rgba(76,76,76,1) 0%,rgba(0,0,0,1) 16%,rgba(17,17,17,1) 51%,rgba(28,28,28,1) 70%,rgba(28,28,28,1) 70%,rgba(44,44,44,1) 82%,rgba(43,43,43,1) 82%,rgba(56,56,56,1) 82%,rgba(44,44,44,1) 82%,rgba(66,66,66,1) 84%,rgba(84,84,84,1) 91%,rgba(109,109,109,1) 92%,rgba(102,102,102,1) 98%,rgba(28,28,28,1) 100%,rgba(19,19,19,1) 100%);
}
This code fixes your problem:
.button:active {
border-left-style: solid;
border-top-style: solid;
}
EDIT: or please check working codepen
The border you have on the button is the default border. Hou only adjusted the width and the color, not the style.
Therefore it's common practise to define a button like so:
border: 1.5px solid #fcbd3f;
Where solid is the style of the border.

Error centering text on CSS3 button

I am trying to center the text "verksamheter" on my CSS3 button, but I can't get it to work.
HTML:
<span>Verksamheter</span>
CSS:
.verksamheter {
width: 220px;
height: 44px;
font-style: italic;
font-size: 18px;
display: inline-block;
text-align: center;
-webkit-border-radius: 22px;
-moz-border-radius: 22px;
border-radius: 22px;
background-color: #ebebeb;
-webkit-box-shadow: 0 1px rgba(0,0,0,.13), inset 0 2px rgba(255,255,255,.75);
-moz-box-shadow: 0 1px rgba(0,0,0,.13), inset 0 2px rgba(255,255,255,.75);
box-shadow: 0 1px rgba(0,0,0,.13), inset 0 2px rgba(255,255,255,.75);
border: solid 1px #4f4d6a;
background-image: -webkit-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: -moz-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: -o-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: -ms-linear-gradient(top, #6e6c8a, #4f4d6a);
background-image: linear-gradient(to bottom, #6e6c8a, #4f4d6a);
}
.verksamheter span {
vertical-align: middle;
}
The height of the <a> is 44px, so make the line-height of the text 44px as well.
http://jsfiddle.net/s4KJd/
Simply set the line-height property according to the height of the element and the font size used. For example:
.verksamheter {
line-height: 44px;
}
Here's a jsFiddle Demo.

Mysteriously Bold Font CSS3

I am using a webfont (poly) on my page on several buttons. In firefox, everything appears right, but in Chrome the first button's font seems bolder than the others despite using the same CSS3 code (unless I'm missing a typo).
http://ashgavs.cloudant.com/site/_design/AshGavsCouch/betcha/index.html
thats the page, look at Login vs. Login with facebook or Sign up. It's not the length of the text that's affecting the font weight, tested that already.
here's the CSS for the first and second buttons:
#login{
position: absolute;
top: 137px;
left: 19px;
padding-top: 10px;
padding-bottom: 10px;
border-top: 1px solid #aff797;
background: #369942;
background: -webkit-gradient(linear, left top, left bottom, from(#27ca3d), to(#369942));
background: -webkit-linear-gradient(top, #27ca3d, #369942);
background: -moz-linear-gradient(top, #27ca3d, #369942);
background: -ms-linear-gradient(top, #27ca3d, #369942);
background: -o-linear-gradient(top, #27ca3d, #369942);
-webkit-border-radius: 11px;
-moz-border-radius: 11px;
border-radius: 5px;
-webkit-box-shadow: rgba(0,0,0,.7) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,.7) 0 1px 0;
box-shadow: rgba(0,0,0,.7) 0 1px 0;
text-shadow: 0 1px 0 #91d99a;
color: #0e5817;
font-size: 24px;
font-family: 'Poly', serif;
text-decoration: none;
vertical-align: center;
width: 229px;
}
#loginFB{
position: absolute;
top: 196px;
left: 19px;
padding-top: 10px;
padding-bottom: 10px;
border-top: 1px solid #65a9d7;
background: #3e779d;
background: -webkit-gradient(linear, left top, left bottom, from(#65a9d7), to(#3e779d));
background: -webkit-linear-gradient(top, #65a9d7, #3e779d);
background: -moz-linear-gradient(top, #65a9d7, #3e779d);
background: -ms-linear-gradient(top, #65a9d7, #3e779d);
background: -o-linear-gradient(top, #65a9d7, #3e779d);
-webkit-border-radius: 11px;
-moz-border-radius: 11px;
border-radius: 5px;
-webkit-box-shadow: rgba(0,0,0,.7) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,.7) 0 1px 0;
box-shadow: rgba(0,0,0,.7) 0 1px 0;
text-shadow: 0 1px 0 #7ca9c7;
color: #0e3458;
font-size: 24px;
font-family: 'Poly', serif;
text-decoration: none;
vertical-align: center;
width: 229px;
}
Both buttons inherit properties from the same divs, so that can't be the issue either. Thanks.
--Ashley
It may be with your particular browser. Regardless, a very good thing to do (pretty much a requirement these days) is to add a CSS Reset before your own CSS definitions. Just Google "CSS Reset". You will see a lot of results. Basically it removes browser specific formatting so that your CSS is the only effective formatting on the page. No unexpected changes or additions from the browser. Often doing this will solve the kinds of issues you describe. You might want to research the idiosyncrasies of your browser, but to save time just try the reset first.

Move Menu Navigation (Margin?)

I need to move this navigation menu above the content box and below the logo. In other words, the order should be: (1) logo, (2) menu, and (3) content box.
I tried various margin adjustments to the CSS for #navigation to no avail.
How do I do this?
URL: http://ec2-174-129-169-80.compute-1.amazonaws.com/
See screenshot:
You could add top: -57px; to your #navigation CSS like so:
#navigation {
position: relative;
top: -57px;
clear: both;
margin-bottom: 3em;
display: none;
font: 14px/14px sans-serif;
border: 1px solid #D9D9D9;
background: white;
background: -webkit-gradient(linear, left top, left bottom, from(white), to(whiteSmoke));
background: -webkit-linear-gradient(white, whiteSmoke);
background: -moz-linear-gradient(center top, white 0%, whiteSmoke 100%);
background: -moz-gradient(center top, white 0%, whiteSmoke 100%);
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.03);
-webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.03);
-moz-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.03);
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
Make a jsFiddle or post your code please. Without seeing code, first thoughts are that you put the #navigation in the content area. If that's the case, then:
#navigation { margin-top: -50px; }
If #navigation is absolutely positioned:
#navigation { top: -50px; }

Keeping inline text in place

I have been making a button which (hopefully) looks fairly realistic. One part of this is having the text move down 1px inside the button when it is pressed. I've done this by adding an additional pixel to the top and removing one from the bottom.
Unfortunately, I've designed my button to work inline (inline-block) and when the button is "pushed" it means any text on the line also gets pushed down. Now I think I know why (presumably due to the baseline of the text) but I wonder if anyone knows how I can get the same "pushed" effect whilst keeping surrounding text in place. I would like to avoid floats if possible.
Anyway on with the code:
http://gard.me/xsfqH
HTML:
<a class="button noIcon smaller" href="#">Buy Now</a> hello world
CSS:
a.button {
margin: 20px;
display: inline-block;
padding: 12px 12px 12px 12px;
background: none;
background-repeat: no-repeat;
background-position: 9px 5px;
background-position: 9px 5px, 0 0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border-width: 1px;
border-style: solid;
font-family: Verdana, Arial, Sans-Serif;
text-decoration: none;
}
a.button:active {
padding-top: 13px; padding-bottom: 11px;
-webkit-box-shadow: inset 0px 1px 6px -1px #000000;
-moz-box-shadow: inset 0px 1px 6px -1px #000000;
box-shadow: inset 0px 1px 6px -1px #000000;
}
a.button.noIcon {
color: #FFECEA;
background-position: 0 0;
background-color: #E46553;
background-image: -o-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: -moz-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: -webkit-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: -ms-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #D15039), color-stop(1, #F27466));
border-color: #A03E33;
}
since it's inline-block you can use vertical-align.
so all you have to do is
a.button:active {
padding-top: 13px;padding-top:11px;
-webkit-box-shadow: inset 0px 1px 6px -1px #000000;
-moz-box-shadow: inset 0px 1px 6px -1px #000000;
box-shadow: inset 0px 1px 6px -1px #000000;
vertical-align:1px;
}
and problem solved