I can't get this placeholder to style correctly in Firefox 13.0.1
I have an input field with a placeholder:
<input class="textFieldLarge" placeholder="Username" id="username" name="username" type="text" />
I have this CSS:
.textFieldLarge{
width:400px;
height:50px;
line-height:50px;
padding-left:5px;
padding-right:5px;
background:none;
background-color:#FFF;
border:solid 1px #BBB;
font-family:Arial, Helvetica, sans-serif;
font-size:20px;
color:#333;
}
.textFieldLarge::-webkit-input-placeholder, .textFieldLarge:-moz-placeholder{
font-style:italic;
color:#BBB;
}
This should style the text field #333 and the placeholder #BBB italic. I have this working with chrome and IE but can't figure FF out.
EDIT, FOUND THE PROBLEM THAT I APPLIED ::-webkit-input-placeholder AT THE SAME TIME
Still would appreciate a fix, but I doubt possible as it works fine when both are applied separately. Not a real issue any more but a little annoying.
If one part of a selector is invalid, then the whole selector will be invalidated.
Therefore, one needs to have two different rules for each of -moz- and -webkit-.
It's been a while since posting this question, but in addtition to Gerve's answer, one should use ::-moz-placeholder for Firefox 19+: http://mzl.la/15FPlx6 and can add support for IE10 with :-ms-input-placeholder. So the final code will look like that:
.textFieldLarge::-webkit-input-placeholder {
font-style:italic;
color:#BBB;
}
.textFieldLarge:-moz-placeholder {
font-style:italic;
color:#BBB;
}
.textFieldLarge::-moz-placeholder { /* Firefox 19+ */
font-style:italic;
color:#BBB;
}
.textFieldLarge:-ms-input-placeholder { /* IE10 */
font-style:italic;
color:#BBB;
}
Related
this code works Choreme and Firefox . But not working on İE 10 . Last td in table cannot take affect. It must turn normal.
.gridview tr
{
font-size: 20px;
border: solid 1px #c1c1c1;
padding-bottom: 3px;
padding-top: 3px;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
background-color: #EEEEEE;
}
.noadres td {
text-decoration:line-through;
font-style:italic;
background-color:#f5eded;
}
.noadres td.etkabone {
text-decoration:solid;
font-style:normal;
}
html
<table class="gridview">
<tr class="noadres">
<td>HELLO</td>
<td>MY</td>
<td class="etkabone" >NAME</td>
</tr>
</table>
https://jsfiddle.net/dwc7kjmo/
In CSS2 the text-decoration property was a regular property with the syntax:
none | [ underline || overline || line-through || blink ] | inherit
In the CSS Text Decoration Module Level 3 : the text-decoration property is now a shorthand property with syntax:
<'text-decoration-line'> || <'text-decoration-style'> ||
<'text-decoration-color'>
where the values for <'text-decoration-style'> are:
solid | double | dotted | dashed | wavy
So now you can see why text-decoration:solid; works in Chrome and Firefox, because according to the newer spec - it is perfectly legal code.
Here is the browser support for the new text-decoration properties.
Notice that IE doesn't support the new syntax.
So, like others have mentioned, you should use text-decoration:none for greater browser support.
Change CSS to:
.noadres td.etkabone {
text-decoration:none;
font-style:normal;
}
solid is not valid for IE.
p.s. If you select inspect element you will see solid has a red underline.
The problem is here:
.noadres td.etkabone {
text-decoration:solid; /*This is invalid value for this property for IE*/
font-style:normal;
}
solid is the by default value of this property but IE does not support it.
You might want the normal font having no strike-through. Please change the above to the following:
.noadres td.etkabone {
text-decoration:none;
font-style:normal;
}
I am using Twitter bootstrap CSS. Below you can see how the same code is displayed differently with FireFox and Chrome.
This is quite strange. Firebug tells me that the placeholder's css is set like this to light grey:
:-moz-placeholder {
color: #999999;
}
This should affect all placeholders within all elements as its correctly done in Chrome.
But in Firefox why are textareas correctly applied, but input is not? How can I fix this?
<input id="id_referred_by" type="text" maxlength="50" name="referred_by" placeholder="...was referred by?">
<textarea id="id_contacts_interests" name="contacts_interests" cols="40" placeholder="Any particular interests?" rows="4"></textarea>
Chrome:
Firefox:
update:
The comments below gave me an idea:
Input has unlike textarea the color: #9999 entry crossed out, which means something is overriding it.
select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
color: #555555;
display: inline-block;
font-size: 13px;
height: 18px;
line-height: 18px;
margin-bottom: 9px;
padding: 4px;
}
It is in fact this color: #555555;. When I disable it in firebug, it all works. How comes Chrome doesn't care about this but Firefox do? Any tips how fix this across both browsers? I am still new to css.
I've made a little fiddle a while ago because of this weird pseudo-element, the result ? You can't add a coma between the selector, you have to specify your rule twice, that's a shame.
The HTML:
<input type="text" id="test-webkit" placeholder="test-webkit" /><br />
<input type="text" id="test-moz" placeholder="test-moz" /><br />
<input type="text" id="test-both" placeholder="test-both" /><br />
<input type="text" class="test-both" placeholder="test-both-separately" />
The CSS:
/* Works on Webkit */
#test-webkit::-webkit-input-placeholder {
color: red;
}
/* Works on Firefox */
#test-moz:-moz-placeholder {
color: red;
}
/* Don't work */
#test-both::-webkit-input-placeholder, #test-both:input:-moz-placeholder {
color: red;
}
/* Works on both */
.test-both::-webkit-input-placeholder {
color: red;
}
.test-both:-moz-placeholder {
color: red;
}
The Fiddle.
The problem is that Firefox change the opacity of the field, and with that you think its a different color, but its not... add "opacity:1;" and it will work exactly the same in all browsers
input:-moz-placeholder {
color: #999999;
opacity: 1;
}
input::-moz-placeholder {
color: #999999;
opacity: 1;
}
As an update below a full list of placeholders you need to use. :-moz is deprecated in newer firefox versions.
You need to specify the rules several times and can not combine them on a single line. This is due to the fact that the browser will interpret them as a single selector. It will cause an error because Firefox does not know the webkit rule.
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
color:#bbb;
font: 12px Verdana, Arial,Tahoma, sans-serif;
}
input:-moz-placeholder, textarea:-moz-placeholder {
color:#bbb;
font: 12px Verdana, Arial,Tahoma, sans-serif;
}
input::-moz-placeholder, textarea::-moz-placeholder {
color:#bbb;
font-family: 12px Verdana, Arial,Tahoma, sans-serif;
font: normal;
}
input:-ms-input-placeholder, textarea:-ms-input-placeholder {
color:#bbb;
font: 12px Verdana, Arial,Tahoma, sans-serif;
}
Clear your firefox cache (it may be enough).
and inspect with firebug
install firebug if it's not allready done https://addons.mozilla.org/en-US/firefox/addon/firebug/
right click on the input, and click on Inspect Element with Firebug.
to see if there's a css property with an higher priority.
Chrome, IE, and Safari...all have teh same interpretaions of my CSS for a file upload box...but Firefox...does not adhere to the width property..by about 40 px...so it looks..bad.
How do I handle this...How do I make Firefox conform similarly to Chrome, IE, and Safari?
It looks like I might need to use a Firefox extentsion but which one and how?
File Upload CSS
input.te7
{
background:#ffffff;
border-radius: 2px;
padding-top:3px;
width:250px;
height:33px;
border:1px solid #eeeeee;
font-size:18px;
}
input.te7:hover
{
border:1px solid #888888;
}
If you define a input:
input{
width: 250;
}
it should be the same on all browsers, if not, try this:
<input type="text" name="sized" size="25" />
Then change the other declarations in the css.
I hope this helps! :)
I have a little CSS code as below:
input{
background-image:url(css_img/input_bg.gif);
padding:6px;
margin:1px;
width:250px;
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
font-variant:normal;
height:30px;
-moz-border-radius:3px 3px 3px 3px;
-moz-box-shadow:0 2px 3px #DDDDDD;
border:1px solid #aaa;
color:#333333;
}
But this code changes the style of all the <input type="..."/> tags. How can I change the style of just text fields <input type="text" name="name" />? I don't want to have to add classes to them.
Also is there any way to round the corner just using plain CSS (not using image) which diplays well in Internet Explorer.
Please help me...
Use an attribute selector:
input[type="text"] {
/* styles here */
}
Use an attribute selector:
input[type="text"] { styles here }
As Eric and Rikudo stated :
input[type="text"]
For the corners in ie use CSS3 PIE
You can also use :
input[type=text]
input[type^=te]
input[type$=ex]
input[type*=t]
Element input with attribute type which contains a value that is equal to, begins with, ends with or contains a certain value.
More info here
I use this piece of CSS code for fieldset in my ASP.net
.important
{
border:1px solid #33CC00;
padding:8px 10px 7px 20px;
}
.important
{
-moz-border-radius-bottomleft:4px;
-moz-border-radius-bottomright:4px;
-moz-border-radius-topleft:4px;
-moz-border-radius-topright:4px;
background:#FFFFFF none repeat scroll 0 0;
}
.important legend
{
-moz-border-radius-bottomleft:4px;
-moz-border-radius-bottomright:4px;
-moz-border-radius-topleft:4px;
-moz-border-radius-topright:4px;
-x-system-font:none;
background:#F3FFF3 none repeat scroll 0 0;
border:1px solid #33CC00;
color:#33AA00;
font-family:"Trebuchet MS";
font-size:1.2em;
font-size-adjust:none;
font-stretch:normal;
font-style:normal;
font-variant:normal;
font-weight:normal;
line-height:normal;
padding:1px 15px;
}
It look fine on FireFox but it look like crap on IE7 and IE8. I'm not sure how i can fix this on IE. Does anyone know any website dealing with CSS hack in IE or should i just give up because life is too short to waste on cross browser compatibility.
-moz-border-radius- is a Mozilla specific selector which IE will ignore. border-radius is the equivalent CSS3 selector, but IE almost certainly won't support it (Firefox 3 does, but I seem to remember there are problems with either the standard or the implementation)