Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Instead of using <code>!important</code>, you can use an <em><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors" rel="noreferrer">attribute selector</a></em> which will override the default as it will be more specific than simply using a <code>class</code>. Not good with specificity concept? Refer <a href="http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/" rel="noreferrer">this</a> article.</p> <p>For calculating the specificity of your selectors, you can use <a href="http://specificity.keegan.st/" rel="noreferrer">this</a> website.</p> <p><sup>[1]</sup> Using <code>class[attr=class]</code></p> <pre><code>.input-large[class="input-large"] { width: 400px; } </code></pre> <p>OR</p> <p><sup>[2]</sup> Using <code>tag[attr=class]</code></p> <pre><code>input[class="input-large"] { width: 400px; } </code></pre> <p>And using <code>!important</code> is not an awful practice if you use it in the right place.</p> <hr> <p>Note that above selectors, <sup>[1]</sup> will make <strong>all elements</strong> <code>width</code> to <code>400px</code> having a <code>class</code> of <code>input-large</code> and in case of selector <sup>[2]</sup>, it will set <code>width</code> to <code>400px</code> for <strong>all <code>input</code></strong> elements having <code>class</code> of <code>input-large</code>, so if you want, you can call <em>multiple classes</em> i.e <code>.class.class</code> on <code>input</code> tag and use the selector below..</p> <pre><code>.input-large.input-large-altered { width: 400px; } </code></pre> <p>So this will select <strong>any</strong> element having both of these classes set, if you want to be more specific, and want to set only for <code>input type="text"</code> than you can always write even a more specific selector like</p> <pre><code>input[type="text"].input-large.input-large-altered { width: 400px; } </code></pre> <p>So the above one will <strong>only</strong> target to <code>input</code> element whose <code>type</code> attribute is holding a <code>value</code> of <code>text</code> <strong>AND</strong> having both the classes i.e <code>.input-large</code> <code>.input-large-altered</code></p> <p><a href="http://jsfiddle.net/xryQK/1/" rel="noreferrer"><strong>Demo</strong></a></p> <p><a href="http://jsfiddle.net/xryQK/2/" rel="noreferrer"><strong>Demo 2</strong></a></p> <p><a href="http://jsfiddle.net/xryQK/557/" rel="noreferrer"><strong>Demo 3</strong></a> (Multiple classes)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload