Is there anyway I can get ::moz-selection applied to input elements, even if I have to edit some file in userChrome.css, userContent.css or some similar file?
thanks
The value of an input is not a text-node in the DOM, therefore CSS-selectors will not be able to target it.
According to this question: textarea::selection and ::-moz-selection it's not possible. Maybe it will be in future browsers.
Related
Does anyone knows what this selector is for? I tried to apllied rules to find out (smth like color: red; and so on...), but i seems it doenst change anything and i cant find something in the docs about it.
Code related to question
This is related to the <code> html tag. It will apply given style properties to this element.
Check W3C docu:
https://www.w3schools.com/tags/tag_code.asp
The HTML code element is used to represent code in browsers. It usually has a monospace font and some other stylings. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code
For example:
<p>Did you know you can use a <code><span></code> element to style arbitrary text?</p>
What does the following CSS do and is it valid?
h4 {
width: 83%;
#width: 75%;
}
It is not valid. #width: 75%; is a syntax error, since # isn't used in CSS property names (although it is used in CSS selectors, to select elements with specific ids). Most browsers will ignore it (hopefully) and only the first rule will be applied.
It might have been someone's attempt to write a CSS comment. This is the valid way: /*This is a comment*/
Edit
I would suggest using a CSS reset file to account for browser differences.
Apparently there's a hash hack which looks exactly like the one you have, but I have no idea what specific browsers the author is trying to target or filter since there aren't any reliable results as to what browsers apply the rule and what don't (that looooooong list of user agent strings isn't what I'd call reliable; I'd call it inconsistent).
In any case, a hash is not a valid character for property names. I'm sure anyone that isn't IE will squarely discard it on sight.
using # before a property is applying different css style for ie 7. Is a css hack like *. To make it valid you can use conditional comments for ie.
From what I've read on http://developer.expressionz.in/blogs/2007/09/08/for-your-ies-only/ the hash-hack is intended to make a rule only visible to IE browsers. Since it is - as already mentioned by others - not a valid property, other browsers will ignore it.
BTW if the second width was not preceded by #, it would take width = 75% and not 83%. The last value always overrides all the preceding ones. As others pointed out, it could be a hack, which I don't know but most likely a syntax error.
To basically answer both your questions.
The # before the property targets IE7 & IE6 (and lower)
No, it's not valid.
I asked the same question, there's more info there that may be helpful to others:
Post: " CSS - "#" sign before property "
I am working on styling my <blockquote> but I am not able to find a complete reference that would let me check what is available to me (newbie here).
For example, "box-shadow" property. How to check if I can define for <blockquote> or not? Trial and error?
You can apply any CSS property to any HTML element.
Some inline elements don't support properties of block level elements(i.e. padding on <span>), but you can easily overcome that restriction by defining them block or inline-block
Most documentation you'll find is extraordinarily dense and reads like the specifications. As someone who is learning, my best advice to you is to test it out, make the mistakes and learn from them! You'll spend far less time here waiting for an answer you can test yourself in seconds.
That being said, the Mozilla Developer's Network has (IMHO) the easiest to absorb documentation around.
P.S. yes, you can use box-shadow on blockquotes
Here is the official list of all properties: http://www.w3schools.com/cssref/
I do also like this list: http://www.blooberry.com/indexdot/css/propindex/all.htm
While there may be some specific attributes that work best with some specific block, the general rule is that you can apply any property to any element. The result may vary from a browser to another.
Please note that some browsers support their own set of properties.
What does the following CSS do and is it valid?
h4 {
width: 83%;
#width: 75%;
}
It is not valid. #width: 75%; is a syntax error, since # isn't used in CSS property names (although it is used in CSS selectors, to select elements with specific ids). Most browsers will ignore it (hopefully) and only the first rule will be applied.
It might have been someone's attempt to write a CSS comment. This is the valid way: /*This is a comment*/
Edit
I would suggest using a CSS reset file to account for browser differences.
Apparently there's a hash hack which looks exactly like the one you have, but I have no idea what specific browsers the author is trying to target or filter since there aren't any reliable results as to what browsers apply the rule and what don't (that looooooong list of user agent strings isn't what I'd call reliable; I'd call it inconsistent).
In any case, a hash is not a valid character for property names. I'm sure anyone that isn't IE will squarely discard it on sight.
using # before a property is applying different css style for ie 7. Is a css hack like *. To make it valid you can use conditional comments for ie.
From what I've read on http://developer.expressionz.in/blogs/2007/09/08/for-your-ies-only/ the hash-hack is intended to make a rule only visible to IE browsers. Since it is - as already mentioned by others - not a valid property, other browsers will ignore it.
BTW if the second width was not preceded by #, it would take width = 75% and not 83%. The last value always overrides all the preceding ones. As others pointed out, it could be a hack, which I don't know but most likely a syntax error.
To basically answer both your questions.
The # before the property targets IE7 & IE6 (and lower)
No, it's not valid.
I asked the same question, there's more info there that may be helpful to others:
Post: " CSS - "#" sign before property "
I'm using a combination of two classes on a span element.
Both look like they're working by themselves... Together they're not.
.black {color:black;}
.size_14 {font-size:14px;}
<span class="black size_14">my text is not black..neither large</span>
I tried changing the size_14 class name for another one (large) and in this case it is working.
Is size_14 an invalid class name?
SOLVED
I was overriding the behaviour with
.article_text_div .size_14 {color:#6D6E71;}
But thanks to this mistake I discovered It's better(?) not to use underscores inside class names
Double thanks
Luca
That example seems to work fine. There must be another rule that is overriding your change. Check the CSS with Firebug or a similar inspector, it will tell you exactly which classes are being used and overridden.
Underscores are not recommended in class names and ID's. Support is mixed across the board. I would remove it or replace it with a dash.
If I were you I'd be inclined to try the following, but without seeing the rest of the code it's difficult to tell if it'll make a difference..
.black{color:black;}
.size-14, span.size-14{font-size:14px;}
You can use underscore, article in above comment was written in 2001. All latest browser supports use of _. But most developer prefer to use "-" for class names.
http://jsfiddle.net/ZsR4A/embedded/result/
Works as expected in IE, FF, Chrome. Make sure your size_14 has higher specificity.