Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does an asterisk before an equal sign mean (*=) ? What about the exclamation mark?

Tags:

css

I found these notations in a css :

.nav li ul li a [class*="icol-"] { opacity: 0.5; filter: alpha(opacity=50); padding-top: 4px; }

.secNav .chzn-container { width: 100%!important; max-width: 100%; }

What does the meaning of the * before the = sign ? Is it a comment when using the ! symbol ?

like image 578
pheromix Avatar asked Nov 23 '12 08:11

pheromix


People also ask

What is an asterisk used for?

An asterisk is a star-shaped symbol (*) that has a few uses in writing. It is most commonly used to signal a footnote, but it is sometimes also used to clarify a statement or to censor inappropriate language.

What does an asterisk behind a number mean?

The asterisk , also called a "star," is used for a number of different purposed in mathematics. The most common usage is to denote multiplication so, for example, . When used as a superscript, the asterisk is commonly voiced " -star." A raised asterisk is used to denote the adjoint. , or sometimes the complex conjugate ...

Is asterisk a punctuation mark?

An asterisk is a punctuation mark that you can use to note something in writing, or to stand in for something you've left out.

Does the asterisk go before or after?

For editing and footnote purposes, the asterisk will appear before a word that needs correcting or a sentence that needs elaborating, and the additional information will be placed beside a corresponding asterisk at the bottom of the page.


1 Answers

element[attribute*="includesthis"]

In other words:

<a class="someclassicol-hello">Click me and win a free monkey</a>

Is matched by

a[class*="icol-"]

If the string appears anywhere in the attribute, it's a match.

There is also ^= for begins with, and $= for ends with. Read more on this here.


!important forces rules to override each other, when they otherwise wouldn't.

a { color: red !important }
a.blue { color: blue }

<a class="blue">I'm actually red, because the less specific rule is !important</a>

Read more on that here. Especially this bit:

When Should !important Be Used?

As with any technique, there are pros and cons depending on the circumstances. So when should it be used, if ever? Here’s my subjective overview of potential valid uses.

NEVER

!important declarations should not be used unless they are absolutely necessary after all other avenues have been exhausted. If you use !important out of laziness, to avoid proper debugging, or to rush a project to completion, then you’re abusing it, and you (or those that inherit your projects) will suffer the consequences.

like image 99
Alex Wayne Avatar answered Mar 06 '23 15:03

Alex Wayne