Advanced CSS not working in any version of IE - css

JSFiddle, as requested: http://jsfiddle.net/Es8PK/
So I'm making a website with a single universal stylesheet. This sheet has around 40 different commands (if that's the right word) that work exactly as intended in every version of browser, include IE 8 and up. However, I have two special features on my site, being custom buttons at the top of every page, and a special navigation bar on one page. Both of these feature just refuse to work in any version of IE, even though I've checked with caniuse.com and every command in there is supported by IE 11 (which isn't working). Here is the part of the stylesheet that isn't working, and then the html that uses those parts:
CSS:
/* BUTTONS IN HEADER */
.button {
/* text */
text-decoration: none;
font: 16px/1em 'Droid Sans', sans-serif;
font-weight: bold;
text-shadow: rgba(255,255,255,.5) 0 1px 0;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
/* layout */
padding: .5em .6em .4em .6em;
margin: .5em;
display: inline-block;
position: relative;
-webkit-border-radius: 8px;
border-radius: 8px;
/* effects */
border-top: 1px solid rgba(255,255,255,0.8);
border-bottom: 1px solid rgba(0,0,0,0.1);
background-image: -webkit-radial-gradient(top, ellipse cover, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 100%), url(http://iwantaneff.in/t/http://iwantaneff.in/t/noise.png);
background-image: -moz-radial-gradient(top, ellipse cover, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 100%), url(http://iwantaneff.in/t/http://iwantaneff.in/t/noise.png);
background-image: -ms-radial-gradient(farthest-corner ellipse at top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 100%), url(http://iwantaneff.in/t/http://iwantaneff.in/t/noise.png);
background-image: radial-gradient(farthest-corner ellipse at top, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 100%), url(http://iwantaneff.in/t/http://iwantaneff.in/t/noise.png);
-webkit-transition: background .2s ease-in-out;
transition: background .2s ease-in-out;
/* color */
color: hsl(0, 0%, 40%) !important;
background-color: hsl(0, 0%, 75%);
-webkit-box-shadow: inset rgba(255,254,255,0.6) 0 0.3em .3em, inset rgba(0,0,0,0.15) 0 -0.1em .3em, /* inner shadow */ hsl(0, 0%, 60%) 0 .1em 3px, hsl(0, 0%, 45%) 0 .3em 1px, /* color border */ rgba(0,0,0,0.2) 0 .5em 5px; /* drop shadow */
box-shadow: inset rgba(255,254,255,0.6) 0 0.3em .3em, inset rgba(0,0,0,0.15) 0 -0.1em .3em, /* inner shadow */ hsl(0, 0%, 60%) 0 .1em 3px, hsl(0, 0%, 45%) 0 .3em 1px, /* color border */ rgba(0,0,0,0.2) 0 .5em 5px; /* drop shadow */
}
.round, .round:after {
border-top: none;
-webkit-border-radius: 1em;
border-radius: 1em;
}
.button.blue {
color: hsl(208, 50%, 40%) !important;
background-color: hsl(208, 100%, 75%);
-webkit-box-shadow: inset rgba(255,254,255,0.6) 0 0.3em .3em, inset rgba(0,0,0,0.15) 0 -0.1em .3em, /* inner shadow */ hsl(208, 50%, 55%) 0 .1em 3px, hsl(208, 50%, 40%) 0 .3em 1px, /* color border */ rgba(0,0,0,0.2) 0 .5em 5px; /* drop shadow */
box-shadow: inset rgba(255,254,255,0.6) 0 0.3em .3em, inset rgba(0,0,0,0.15) 0 -0.1em .3em, /* inner shadow */ hsl(208, 50%, 55%) 0 .1em 3px, hsl(208, 50%, 40%) 0 .3em 1px, /* color border */ rgba(0,0,0,0.2) 0 .5em 5px; /* drop shadow */
}
.button.blue:hover { background-color: hsl(208, 100%, 83%); }
.button:focus {
outline: none;
color: rgba(254,255,255,0.9) !important;
text-shadow: rgba(0,0,0,0.2) 0 1px 2px;
}
.button.disabled, .button.disabled:hover {
opacity: .5;
cursor: default;
color: rgba(0,0,0,0.2) !important;
text-shadow: none !important;
background-color: rgba(0,0,0,0.05);
background-image: none;
border-top: none;
-webkit-box-shadow: inset rgba(255,254,255,0.4) 0 0.3em .3em, inset rgba(0,0,0,0.1) 0 -0.1em .3em, /* inner shadow */ rgba(0,0,0,0.3) 0 .1em 1px, /* border */ rgba(0,0,0,0.2) 0 .2em 6px; /* drop shadow */
box-shadow: inset rgba(255,254,255,0.4) 0 0.3em .3em, inset rgba(0,0,0,0.1) 0 -0.1em .3em, /* inner shadow */ rgba(0,0,0,0.3) 0 .1em 1px, /* border */ rgba(0,0,0,0.2) 0 .2em 6px; /* drop shadow */
-webkit-transform: translateY(3px);
-ms-transform: translateY(3px);
transform: translateY(3px);
}
.button:active {
background-image: -webkit-gradient(radial, 50% 0, 100, 50% 0, 0, from( rgba(255,255,255,0) ), to( rgba(255,255,255,0) )), url(http://iwantaneff.in/t/noise.png);
background-image: -moz-gradient(radial, 50% 0, 100, 50% 0, 0, from( rgba(255,255,255,0) ), to( rgba(255,255,255,0) )), url(http://iwantaneff.in/t/noise.png);
background-image: gradient(radial, 50% 0, 100, 50% 0, 0, from( rgba(255,255,255,0) ), to( rgba(255,255,255,0) )), url(http://iwantaneff.in/t/noise.png);
-webkit-box-shadow: inset rgba(255,255,255,0.6) 0 0.3em .3em, inset rgba(0,0,0,0.2) 0 -0.1em .3em, /* inner shadow */ rgba(0,0,0,0.4) 0 .1em 1px, /* border */ rgba(0,0,0,0.2) 0 .2em 6px; /* drop shadow */
box-shadow: inset rgba(255,255,255,0.6) 0 0.3em .3em, inset rgba(0,0,0,0.2) 0 -0.1em .3em, /* inner shadow */ rgba(0,0,0,0.4) 0 .1em 1px, /* border */ rgba(0,0,0,0.2) 0 .2em 6px; /* drop shadow */
-webkit-transform: translateY(.2em);
-ms-transform: translateY(.2em);
transform: translateY(.2em);
}
/* NAVIGATION BAR */
nav {
text-align: center;
margin: 20px 0;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background: #efefef;
background-image: linear-gradient(to top, #FFFFFF 0%, #3366FF 100%);
background-image: -moz-linear-gradient(top, #FFFFFF 0%, #3366FF 100%);
background-image: -webkit-linear-gradient(top, #FFFFFF 0%, #3366FF 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 20px;
border-radius: 7px;
list-style: none;
position: relative;
display: inline-table;
}
nav ul:after {
content: "";
clear: both;
display: block;
}
nav ul li {
float: left;
}
nav ul li#LastOne {
position: relative;
}
nav ul li:hover {
background: #4b545f;
background: linear-gradient(to top, #4f5964 0%, #5f6975 40%);
background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
}
nav ul li:hover a {
color: #fff;
}
nav ul li a {
display: block;
padding: 15px 30px;
color: #0000FF;
text-decoration: none;
font-weight: bold;
text-shadow: 2px 2px 12px #000;
}
nav ul ul {
background: #5f6975;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
text-align: left;
}
nav ul ul#BestOne {
position: absolute;
right: 0;
}
nav ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position: relative;
white-space: nowrap;
}
nav ul ul li a {
padding: 15px 15.5px;
color: #fff;
}
nav ul ul li a:hover {
background: #4b545f;
}
HTML (buttons):
<div id="contain2">
<br /><hr>
<a role="button" class="button round disabled">Home</a>
Software
Support
Consulting Services
What's New
Our Clients
About Us
Contact Us
</div>
HTML (navigation bar):
<nav>
<ul>
<li>Seminars and Training
<ul>
<li>New User Training</li>
<li>Making the Most of TCE</li>
<li>Cash Management Workshop</li>
<li>System Manager Training</li>
<li>Service Management Workshop</li>
<li>Advanced System Manager Training</li>
</ul></li>
<li>Peer Work Groups
<ul>
<li>Operational Audit Groups</li>
<li>Sales Manager Work Group</li>
<li>Management Work Study Group</li>
<li>System Manager Work Group</li>
</ul></li>
<li>On-Line User Groups
<ul>
<li>Prospector Pro User Groups</li>
<li>System Manager User Groups</li>
<li>Service & Parts User Group</li>
<li>Owner/CEO User Group</li>
</ul></li>
<li>Coaching Services
<ul>
<li>Financial Analysis and Review</li>
<li>Adjusting Your Inventory</li>
<li>Finding Retail Lending Sources</li>
<li>Obtaining Wholesale Inventory Financing</li>
<li>Building a Buy-Here / Pay-Here Portfolio</li>
</ul></li>
<li id="LastOne">Webinars
<ul id="BestOne">
<li>Obtaining Whole Sale Inventory Financing</li>
<li>Managing Service to Generate Cash</li>
<li>Generating Sales in a Down Market</li>
<li>Stealing Market Share through better CRM</li>
</ul></li>
</ul>
</nav>
I realize this is a lot of code, but I want to make sure anyone willing to try and help me has everything they could possibly need to deduce an answer. In addition, I use Komodo Edit to write my code, and in there it is showing me possible errors in the CSS for background-image in all cases of webkit and ms, and about half the cases of moz and just regular, so that would be a good place to start. Note, all of this works in all other browsers, but not any version of IE that I have (8, 9, 11).
What it looks like in Chrome:
What it looks like in IE:

What about using different css for the older versions of IE?
You can do this by putting this kind of tags in your html document in the head section:
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="ie.css" />
<![endif]-->
This code uses another css file for the browsers that are IE version 9 of lower.

Related

Bootstrap : prevent "nav-tabs nav-justified" from stacking on small screen

I'm using Twitter Bootstrap 3 and I have a sidebar and tabs in it.
<div class="col-md-4">
<div class="side-posts">
<ul class="nav nav-tabs nav-justified">
<li class=""><span data-icon=""></span> Recent</li>
<li class="active"><span data-icon=""></span> Popular</li>
</ul>
<div class="tab-content">
.....
</div>
</div>
</div>
When screen's width gets smaller the tabs stack on each other like this
Is it possible to keep the original look and prevent this change?
I had to write my own tabs style to get it work.
Here is a live bootply
in case link got broken here is the css:
/* CSS used here will be applied after bootstrap.css */
body{
background-color: #f2f2f2;
}
.container{
width: 325px;
}
.side-posts{
margin-top:15px;
}
.post-tabs{
padding:0;
margin-bottom:0;
list-style-type: none;
overflow: hidden;
}
.post-tabs li{
display: inline;
}
.post-tabs a{
display: block;
z-index: 1;
text-decoration: none;
padding: 10px 15px;
float: left;
width: 50%;
text-align:center;
border-bottom: 1px solid #dddddd;
text-shadow: 1px 1px 0 white;
transition:color 0.3s ease;
background: rgba(255,255,255,1);
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,1)), color-stop(47%, rgba(246,246,246,1)), color-stop(100%, rgba(237,237,237,1)));
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed', GradientType=0 );
color:#3b5998;
}
.post-tabs a:hover{
color:#e95c40;
}
.post-tabs li.active a{
border-bottom: 0;
color: #444444;
z-index: 2;
}
.post-tabs li.active:first-child a {
border-right: 1px solid #dddddd;
box-shadow: inset -3px 0px 3px 0px rgba(0,0,0,0.4);
}
.post-tabs li.active:last-child a{
border-left: 1px solid #dddddd;
box-shadow: inset 3px 0px 3px 0px rgba(0,0,0,0.4);
}
.tab-content{
height:400px;
background-color: #dddddd;
}
You can add float:left; and remove float:none; editing the mobile media query inside bootstrap like:
#media (min-width: 768px){
.nav-tabs.nav-justified > li {
float: none;
}
}
#media (max-width: 768px){
.nav-tabs.nav-justified > li {
float: left;
}
}
DEMO http://jsfiddle.net/a_incarnati/52VtD/7771/
This worked perfectly for me, even keeps the default styling for bootstrap justified nav-bar.**
#media (max-width: 768px){
.nav-justified > li {
display: table-cell;
width: 1%;
}
.nav-justified > li > a {
border-bottom: 1px solid #ddd !important;
border-radius: 4px 4px 0 0 !important;
margin-bottom: 0 !important;
}
.nav-justified > li.active > a {
border-bottom: 1px solid transparent !important;
}
}

CSS3 submenu's submenu dont work correctly

i have created a css3 style sheet for creating menu, in submenu of main menu is correct but after creating submenu. The child element of the submenu does not work correctly.
i want to move submenu's submenu to bottom of parent and i can move mouse cursor on child
JSFIDDLE
HTML:
<ul id="nav" class="nav" style='margin-right:0px;padding-right:0px;padding-top:0px;height:30px;'>
<li><a>MAIN MENU</a>
<ul>
<li>MENU 1
<ul>
<li><a>SUBMENU</a></li>
</ul>
</li>
<li>MENU 2</li>
<li>MENU 3</li>
</ul>
</li>
</ul>
CSS3:
#nav {
color: #fff;
margin: 0;
line-height: 100%;
padding-top: 4px;
padding-bottom: 4px;
height: 33px;
background: -moz-linear-gradient(center top , #5E9AE2, #3570B8) repeat scroll 0 0 transparent;
z-index: 10000;
}
#nav li {
margin: 0pt 5px;
padding: 2pt 0pt 5px;
float: right;
position: relative;
list-style: none outside none;
z-index: 10000;
cursor: pointer;
}
#nav a {
color: #fff !important;
text-decoration: none;
display: block;
padding: 9px 10px;
margin-right: 0pt;
border-radius: 5px 5px 5px 5px;
font-weight: normal;
z-index: 100000;
cursor: pointer;
}
#nav .current a, #nav li:hover > a {
z-index: 100000;
background: #fff ! important;
color: #000 ! important;
box-shadow: 0pt 1px 1px rgba(0, 0, 0, 0.2);
}
#nav ul li:hover a, #nav li:hover li a {
z-index: 100000;
background: none repeat scroll 0% 0% transparent;
color: #000 ! important;
box-shadow: none;
}
#nav ul a:hover {
background: -moz-linear-gradient(center top , rgb(198, 71, 53), rgb(147, 35, 19)) repeat scroll 0% 0% transparent ! important;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#c44634), color-stop(100%,#952414)) repeat scroll 0% 0% transparent ! important; /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* Opera 11.10+ */
background: -ms-linear-gradient(top, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* IE10+ */
background: linear-gradient(to bottom, #c44634 0%,#952414 100%) repeat scroll 0% 0% transparent ! important; /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c44634', endColorstr='#952414',GradientType=0 ) ! important; /* IE6-9 */
color: rgb(255, 255, 255) ! important;
border-radius: 0pt 0pt 0pt 0pt;
text-shadow: 0pt 1px 1px rgba(0, 0, 0, 0.1);
cursor: pointer;
}
#nav ul {
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #cfcfcf 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#cfcfcf)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#cfcfcf 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#cfcfcf 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#cfcfcf 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#cfcfcf 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#cfcfcf',GradientType=0 ); /* IE6-9 */
display: none;
margin: 0pt;
padding: 0pt;
text-align: right;
width: 180px;/*طول منو*/
position: absolute;
top: 35px;
right: 0pt;
border-radius: 5px 5px 5px 5px;
direction: rtl;
box-shadow: 0pt 1px 3px rgba(0, 0, 0, 0.3);
}
#nav li:hover > ul {
display: block;
}
#nav ul li {
float: none;
margin: 0pt;
padding: 0pt;
}
#nav ul li ul{
float: none;
margin-top:28px;
margin-right: 180px;
top: 0px;
}
#nav ul li ul li:first-child > a {
border-radius: 5px 5px 5px 5px;
behavior: url('./css/PIE.htc');
}
#nav ul li ul li:last-child > a {
border-radius: 5px 5px 5px 5px;
behavior: url('./css/PIE.htc');
}
#nav ul a {
font-weight: normal;
text-shadow: 0pt 1px 1px rgba(255, 255, 255, 0.898);
}
#nav ul li:first-child > a {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-radius: 5px 5px 0px 0px;
behavior: url('./css/PIE.htc');
}
#nav ul li:last-child > a {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-radius: 0px 0px 5px 5px;
behavior: url('./css/PIE.htc');
}
#nav:after {
z-index: 100000;
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0pt;
height: 0pt;
}
this method not problem but i want to have any submenu and cant fix it.please help me,
#nav ul li ul {
float: none;
margin-right: 180px;
margin-top: 28px; /* <-- this is causing issue */
top: 0;
}
i don't know where the problem every thing work just remove margin-top
and add the html
<ul id="nav" class="nav" style='margin-right:0px;padding-right:0px;padding-top:0px;height:30px;'>
<li><a>MAIN MENU</a>
<ul>
<li>MENU 1
<ul>
<li><a>SUBMENU</a>
<ul>
<li><a>asdasd</a></li>
<li><a>asdasd</a></li>
<li><a>asdasd</a></li>
</ul>
</li>
</ul>
</li>
<li>MENU 2</li>
<li>MENU 3</li>
</ul>
</li>
see demo : jsfiddle

CSS buttons not displaying in IE 8/10

Currently I have creating some pure CSS buttons for a few customer pages. They display fine in all browsers except IE 8/10. They do however display the styles (mostly) if the css is applied as an inline style OR if I turn on compatibility mode (which is off by default).
Here is the page: http://www.americasfinestpolice.com/patrolmens-benevolent-association-custom-watches.aspx
#btn-a-1, #btn-a-3, #btn-a-5, #btn-a-7, #btn-a-9, #btn-a-11 {
outline: none !important;
cursor: pointer !important;
text-decoration: none !important;
text-shadow: 0 1px 1px rgba(0,0,0,.3) !important;
-webkit-border-radius: .5em !important;
-moz-border-radius: .5em !important;
border-radius: .5em !important;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2 !important);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2) !important;
box-shadow: 0 1px 2px rgba(0,0,0,.2) !important;
color: #FFF !important;
border: solid 1px #F61208 !important;
background: #F61205 !important;
background-color: #F61205 !important;
background: -webkit-gradient(linear, left top, left bottom, from(#F61205), to(#9F0601)) !important;
background: -moz-linear-gradient(top, #F61205, #9F0601) !important;
background-image: -ms-linear-gradient(top, #F61205 0%, #9F0601 100%) !important;
background-image: linear-gradient(to bottom right, #F61205 0%, #9F0601 100%) !important;
height: 1% !important;
width: 230px !important;
color: #FFF !important;
overflow: hidden !important;
display: block !important;
}
<div class="btn btn-1"><a href="/nycpbawatches.aspx">
<div class="btn-text btn-2">
NYC PBA Mens<br />Chronograph Watch<br />(CLICK HERE)
</div>
</a>
</div>
Please and thank you for your assistance.

CSS3 Buttons with icon

I am following this tutorial to create CSS 3 button with Icon. But the problem in this tutorial Icon height depends on font-size. If I increase font-size of text, icon fits well but if I try to reduce the font-size, it doesn't fit well.Image I am using is 40x30
a.button {
background-image: -moz-linear-gradient(top, #ffffff, #dbdbdb);
background-image: -webkit-gradient(linear,left top,left bottom,
color-stop(0, #ffffff),color-stop(1, #dbdbdb));
filter: progid:DXImageTransform.Microsoft.gradient
(startColorStr='#ffffff', EndColorStr='#dbdbdb');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient
(startColorStr='#ffffff', EndColorStr='#dbdbdb')";
border: 1px solid #fff;
-moz-box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
-webkit-box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
border-radius: 2px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
padding: 5px 5px;
text-decoration: none;
text-shadow: #fff 0 1px 0;
float: left;
margin-right: 15px;
margin-bottom: 15px;
display: block;
color: #597390;
line-height: 38px;
font-size: 15px;
font-weight: bold;
}
a.button:hover {
background-image: -moz-linear-gradient(top, #ffffff, #eeeeee);
background-image: -webkit-gradient(linear,left top,left bottom,
color-stop(0, #ffffff),color-stop(1, #eeeeee));
filter: progid:DXImageTransform.Microsoft.gradient
(startColorStr='#ffffff', EndColorStr='#eeeeee');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient
(startColorStr='#ffffff', EndColorStr='#eeeeee')";
color: #000;
display: block;
}
a.button:active {
background-image: -moz-linear-gradient(top, #dbdbdb, #ffffff);
background-image: -webkit-gradient(linear,left top,left bottom,
color-stop(0, #dbdbdb),color-stop(1, #ffffff));
filter: progid:DXImageTransform.Microsoft.gradient
(startColorStr='#dbdbdb', EndColorStr='#ffffff');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient
(startColorStr='#dbdbdb', EndColorStr='#ffffff')";
text-shadow: 0px -1px 0 rgba(255, 255, 255, 0.5);
margin-top: 1px;
}
a.button {
border: 1px solid #979797;
}
a.button.icon {
padding-left: 11px;
}
a.button.icon span{
padding-left: 48px;
display: block;
background: url(../img/gmail2.png) no-repeat;
}
Your statement is a little ambiguous and lacks a question, but I'll take a stab.
In this scenario, font-size will always play a small factor, as it will determine the height of the icon. At some point you are going to need to know some details about the button size, but it doesn't have to be affected by font. If you set the button height and the img{ height:100%; } the image will scale to fit the area.
<div id="container">
<h1><img src="http://placedog.com/50/50" alt="" />Button</h1>
</div>
combined with
#container{
border: 2px solid black;
width: 200px;
height: 20px;
}
#container img{
height:100%;
}
Should get you something you close to what you're looking for. I've whipped up a small jsfiddle to demonstrate one way to accomplish this.
It would be helpful if you could share your code.
In the css3 buttons examples of the link you provided, if I decrease font-size and set the following CSS style, works.
span { display: block; }
span is the tag that wraps the text inside the buttons.

Drop down menu to hide on click event

Question
How do I hide my menu on a click event
Background
I am using a pure CSS3 menu in a single page application. It works well.
body {
font: normal .8em/1.5em Arial, Helvetica, sans-serif;
background: #ebebeb;
width: 900px;
margin: 100px auto;
color: #666;
}
a {
color: #333;
}
#nav {
margin: 0;
padding: 7px 6px 0;
line-height: 100%;
border-radius: 2em;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
background: #8b8b8b; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a9a9a9', endColorstr='#7a7a7a'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#a9a9a9), to(#7a7a7a)); /* for webkit browsers */
background: -moz-linear-gradient(top, #a9a9a9, #7a7a7a); /* for firefox 3.6+ */
border: solid 1px #6d6d6d;
}
#nav li {
margin: 0 5px;
padding: 0 0 8px;
float: left;
position: relative;
list-style: none;
}
/* main level link */
#nav a {
font-weight: bold;
color: #e7e5e5;
text-decoration: none;
display: block;
padding: 8px 20px;
margin: 0;
-webkit-border-radius: 1.6em;
-moz-border-radius: 1.6em;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
}
/* main level link hover */
#nav .current a, #nav li:hover > a {
background: #d1d1d1; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb', endColorstr='#a1a1a1'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#a1a1a1)); /* for webkit browsers */
background: -moz-linear-gradient(top, #ebebeb, #a1a1a1); /* for firefox 3.6+ */
color: #444;
border-top: solid 1px #f8f8f8;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}
/* sub levels link hover */
#nav ul li:hover a, #nav li:hover li a {
background: none;
border: none;
color: #666;
-webkit-box-shadow: none;
-moz-box-shadow: none;
}
#nav ul a:hover {
background: #0399d4 !important; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#04acec', endColorstr='#0186ba'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#04acec), to(#0186ba)) !important; /* for webkit browsers */
background: -moz-linear-gradient(top, #04acec, #0186ba) !important; /* for firefox 3.6+ */
color: #fff !important;
-webkit-border-radius: 0;
-moz-border-radius: 0;
text-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}
/* level 2 list */
#nav ul {
background: #ddd; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#cfcfcf'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#cfcfcf)); /* for webkit browsers */
background: -moz-linear-gradient(top, #fff, #cfcfcf); /* for firefox 3.6+ */
display: none;
margin: 0;
padding: 0;
width: 185px;
position: absolute;
top: 35px;
left: 0;
border: solid 1px #b4b4b4;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
/* dropdown */
#nav li:hover > ul {
display: block;
}
#nav ul li {
float: none;
margin: 0;
padding: 0;
}
#nav ul a {
font-weight: normal;
text-shadow: 0 1px 1px rgba(255, 255, 255, .9);
}
/* level 3+ list */
#nav ul ul {
left: 181px;
top: -3px;
}
/* rounded corners for first and last child */
#nav ul li:first-child > a {
-webkit-border-top-left-radius: 9px;
-moz-border-radius-topleft: 9px;
-webkit-border-top-right-radius: 9px;
-moz-border-radius-topright: 9px;
}
#nav ul li:last-child > a {
-webkit-border-bottom-left-radius: 9px;
-moz-border-radius-bottomleft: 9px;
-webkit-border-bottom-right-radius: 9px;
-moz-border-radius-bottomright: 9px;
}
/* clearfix */
#nav:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
#nav {
display: inline-block;
}
html[xmlns] #nav {
display: block;
}
* html #nav {
height: 1%;
}
CSS3 Dropdown Menu by Web Designer Wall
Assuming your question is "what do I need to do with the Javascript?", one of the easiest ways to hide the dropdown is to use a framework, such as jQuery. Using jQuery allows you to write something like (untested):
$('#parent_li').click(function(){
$('#child_li').slideToggle('slow');
});
Which will toggle the visibility state of the list item's child list. In this case, using a slow slide animation, but there are other animation types you can use.
Kindly check if the below link helps
<nav role="navigation">
<div id="menuToggle">
<!--
A fake / hidden checkbox is used as click reciever,
so you can use the :checked selector on it.
-->
<input type="checkbox" />
<span></span>
<span></span>
<span></span>
<ul id="menu">
<li>Home</li>
<li>About</li>
<li>Info</li>
<li>Contact</li>
<a href="https://erikterwan.com/" target="_blank"><li>Show me more</li>
</a>
</ul>
</div>
</nav>
https://codepen.io/erikterwan/pen/EVzeRP

Resources