Simple CSS dropdown appears differently across browsers - css

Hi thanks for reading my first question here at SO.
I'm the admin for http://www.theacoutlet.com and I'm adding some content pages. I took one element from the middle nav. bar ("FIND PRODUCTS") and made it a dropdown via CSS on hover.
The CSS (below) has been validated.
The problem is this sub-menu now displays three different ways in Firefox, IE, and Chrome. It does not appear to me to be very complex and I am stumped. It does not display at all in IE, and of course most of our customers use IE.
IE: Submenu does not display at all on hover.
Firefox: Submenu displays, with a wierd list item bullet (not in the HTML!) on top, and the menu appears over the original "FIND PRODUCTS" text.
Chrome: Submenu displays perfectly, only problem is it disappears quite easily when you try to hover over new items... requires extremely fast/precise mouse movements to keep menu from disappearing.
Code is below. Thanks for reading and appreciate your help!
HTML:
<div class="menisell2">
FIND PRODUCTS <img src="images/de_26.jpg" width="1" height="22" border="0" align="middle">
<span class="menisell2content">
<br>SEARCH<br><br>
COOLING<br><br>
HEAT PUMP<br><br>
DUAL FUEL<br><br>
GAS HEAT<br><br>
MINI SPLITS<br><br>
PACKAGE UNITS<br><br>
</span>
</div>
CSS:
.menisell2, .menisell2 a:visited {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
display: inline;
position:relative;
}
.menisell2 a:visited {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
}
.menisell2content a:visited {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
}
.menisell2:hover {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #CE252C;
text-decoration: none;
}
.menisell2 a {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.menisell2content a {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
background-color: #4682B4;
}
.menisell2content a:hover {
color: #CE252C;
}
.menisell2:hover .menisell2content{
visibility:visible;
}
.menisell2content{
visibility:hidden;
position:absolute;
width:100%;
display:list-item;
font-size: 12px;
color: #FFFFFF;
background-color: #4682B4;
}

Related

Placeholder colors is different in IE and FF

I have HTML form and placeholder css code
#email::-webkit-input-placeholder {
font-weight:400;
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
color:#333 !important;
}
#email::-moz-placeholder {
font-weight:400;
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
color:#333 !important;
}
#email:-ms-input-placeholder { font-weight:400;
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
color:#333 !important;
}
#email::-ms-input-placeholder { font-weight:400;
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
color:#333 !important;
}
#email::placeholder { font-weight:400;
font-family: Helvetica, Arial, sans-serif;
font-size: 16px;
color:#333 !important;
}
IE example:
FF example:
Could you help me?
In Firefox the color of the placeholder looks faded when compared to other browsers. In the image below, Firefox is shown on the left whilst Chrome is shown on the right:
This is because, by default, all placeholders in Firefox have an opacity value applied to them, so in order to fix this you need to simply reset that value, in your case add:
#email::-moz-placeholder {
opacity: 1;
}
I learned this from CSS-tricks, here's the source.

how to force font down the css tree?

I have a situation that I can't seem to figure out with CSS.
I have a sidebar category menu that I want to be a certain font.. but the other content when it is in the sidebar to be the standard font.
The issue is that the div structure looks like this.
...
<div class="col-left sidebar">
<div id"sidebar-nav" class"block sidebar-nav-left codnitiveSidenavLeft">
<div class="block-title">..</div>
<div class="block-content">
Now what happens is that block-content has a font value in css which is the normal font.. when it is not under the class "block sidebar-nav-left coditiveSidenameLeft" then that is fine.. when it is under the "block sidebar-nav-left coditiveSidenameLeft" class then I want to use a special font called destroyregular.. here is what I have in the css.
.block .block-content {
padding: 5%;
font-family: 'Lato',sans-serif;
/*font-family: "destroyregular";*/
font-size: 100%;
font: bold 12px Arial, sans-serif;
color: #FFFFFF;
text-transform: uppercase;
}
#sidebar-nav.block.sidebar-nav-left.codnitiveSidenavLeft
{
padding: 5%;
font-family: "destroyregular" !important;
font-size: 100%;
/*font: bold 12px Arial, sans-serif;*/
color: #E6E6E6;
text-transform: uppercase;
}
While container class"block sidebar-nav-left coditiveSidenameLeft" does have the destroyregular font, it is overridden by the block-content.. how can I force the destroyregular font down to the block-content only if it is under it?
Thanks in advance..
--Corrected typo in div... side-nav was corrected to sidebar-nav sorry..
--Corrected typo #2!! arrgh.. #sidebar-nav.block.sidebar-nav-left codnitiveSidenavLeft
-Ken
Change the sidebar and .block-content to this:
#side-nav
{
padding: 5%;
font-family: "destroyregular", Arial, sans-serif;
font-size: 12px;
font-weight: bold;
color: #E6E6E6;
text-transform: uppercase;
}
.block-content {
padding: 5%;
font-family: 'Lato', Arial, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
text-transform: uppercase;
}
This selector:
#sidebar-nav.block.sidebar-nav-left.codnitiveSidenavLeft
Doesn't select anything in that HTML snippet you posted. The ID and class names don't match.
UPDATE: With the corrected selector, what's going on now is that the font destroyregular is getting applied with very high specificity to the .block, but .block-content will not inherit it over something set specifically for .block-content jsut because the parent has high specificity. This is how I would do it, same HTML and add this CSS:
#sidebar-nav.block.sidebar-nav-left.codnitiveSidenavLeft .block-content {
font-family: "destroyregular";
}
This is not optimal. I think it's overspecified. And probably you can get rid of the font definition on the other (overspecified) selector and move it to that one, but that depends on what you actually need.

CSS :link and :visited not working

I'm having one very difficult time getting :link and :visited to work on my links. I have been searching online for literally hours and read over 20 different instances of the same problem. Bizarrely enough, :hover and :active are working. What is going on?
Here's the code lines in my stylesheet:
H1 { text-align: center; width:1000px; font-size: 30pt; font-weight: bold; }
a.artlinks:link {color:#40C0FF; text-decoration: none; font-family: Cambria, Arial; }
a.artlinks:visited { color:#FF00FF; text-decoration: none; font-family: Cambria, Arial; }
a.artlinks:hover {color:#98D7F6; text-decoration: none; font-family: Cambria, Arial; }
a.artlinks:active {color:#FF0000; text-decoration: none; font-family: Cambria, Arial; }
and when I call it in my .html the code is:
<h1>Hello World!</h1>
Does anyone have a solution and also, a more efficient way to give the common a.artlinks parameters simultaneously? Thanks
Your code needs a bit of a tidy up, but this is how I would do it (edit I removed the width property from the h1 for demonstration purposes).
H1 {
text-align: center;
font-size: 30pt;
font-weight: bold;
}
a.artlinks {
text-decoration: none;
font-family: Cambria, Arial;
color:#40C0FF;
}
a.artlinks:visited {
color:#FF00FF;
}
a.artlinks:hover {
color:#98D7F6;
}
a.artlinks:active {
color:#FF0000;
}
See this jsfiddle: http://jsfiddle.net/lharby/zkb8thck/
As the a class has the same properties, you can define those once in a.artlinks (font-family, text-decoration). The other elements that are unique can then be defined for :hover, :active etc.

CSS link to act as button but inheriting behavior

I have link CSS define as:
A
{
color: #315393; font-family: verdana; font-weight: 500; text-decoration:underline; font-size: 10px;
}
A:Hover
{
color: #999999; font-family: verdana; font-weight: 500; text-decoration:none; font-size: 10px;
}
However, there are a couple cases where I want a link to act like a button and for that I use bootstrap and give them the class of "btn btn-primary", but since they are still links it seems they are still using the above CSS. How can I exclude the link behavior CSS from these and is there a way to do it in-line to the link?
You can use :not pseudo-class to exclude certain elements from the matched selector:
a:not(.btn.btn-primary) {
color: #315393;
font-family: verdana;
font-weight: 500;
text-decoration:underline;
font-size: 10px;
}
a:not(.btn.btn-primary):hover {
color: #315393;
font-family: verdana;
font-weight: 500;
text-decoration:underline;
font-size: 10px;
}

How can i stop my text css from over-riding my form on my blog?

Currently Im using the below css for all of my text. However it is changing my form text on my blog (which I don't want it to do.) How can i set a new style for this blog-sidebar-form. I just want to center the text and make it bold, etc.
http://jeffreydowellphotography.com/blog/
p {
font-family: "HelveticaNeue-Regular", "Helvetica Neue Regular", ``"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 16px;
font-weight: 300;
max-width: 550px;
color: #4d4d4d;
text-align: left;
line-height: 175%;
letter-spacing: 1px;
word-spacing: 0px;
margin-top: 20px;
}
You should probable do something like this for the blog.
So you can overwrite the base style.
p {
font-family: "HelveticaNeue-Regular", "Helvetica Neue Regular", ``"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-size: 16px;
font-weight: 300;
max-width: 550px;
color: #4d4d4d;
text-align: left;
line-height: 175%;
letter-spacing: 1px;
word-spacing: 0px;
margin-top: 20px;
}
p.blog {text-align: right/*and other code*/}
<p class="blog"> This paragraph will be right-aligned. </p>/*you should give all the p in your blog the blog element*/
Good luck with it.
Give the form a class, or if it is the only form, I think you can just put form. From there, I believe you can give a negation pseudo class:
:not(form){text-align:center; font-weight:bold; /*any other css you would like to enter. make sure you copy the entire line. this is a comment so you can delete it.*/}
Or maybe you could affect the inputs of the form:
form input{ text-align:center; font-weight:bold; }
I hope they work.

Resources