CSS attribute selectors

Attribute selectors let you target an element based on its attributes. You can specify the element’s attribute only, so all the elements that have that attribute — whatever the value — within the HTML will be targeted, or be more specific and target elements that have particular values on their attributes — and this is where attribute selectors show their power.

There are 6 different types of attribute selectors:

  • [att=value]
    The attribute has to have the exact value specified.
  • [att~=value]
    The attribute’s value needs to be a whitespace separated list of words (for example, class=”title featured home”), and one of the words is exactly the specified value.
  • [att|=value]
    The attribute’s value is exactly “value” or starts with the word “value” and is immediately followed by “-”, so it would be “value-”.
  • [att^=value]
    The attribute’s value starts with the specified value.
  • [att$=value]
    The attribute’s value ends with the specified value.
  • [att*=value]
    The attribute’s value contains the specified value.

CSS calculate the specificity

How do you calculate the specificity of a particular selector? It’s fairly straightforward if you take into account that specificity will be represented as four numbers separated by commas, like: 1, 1, 1, 1 or 0, 2, 0, 1

  1. The first digit (a) is always zero, unless there is a style attribute applied to that element within the markup itself
  2. The second digit (b) is the sum of the number of IDs in that selector
  3. The third digit (c) is the sum of other attribute selectors and pseudo-classes in that selector. Classes (.example) and attribute selectors (eg. li[id=red]) are included here.
  4. The fourth digit (d) counts the elements (like table, p, div, etc.) and pseudo-elements (like :first-line)
  5. The universal selector (*) has a specificity of zero
  6. If two selectors have the same specificity, the one that comes last on the stylesheet will be applied

Let’s take a look at a few examples, to make it easier to understand:

  • #sidebar h2 — 0, 1, 0, 1
  • h2.title — 0, 0, 1, 1
  • h2 + p — 0, 0, 0, 2
  • #sidebar p:first-line — 0, 1, 0, 2

From the following selectors, the first one is the one who will be applied to the element, because it has the higher specificity:

  • #sidebar p#first { color: red; } — 0, 2, 0, 1
  • #sidebar p:first-line { color: blue; } — 0, 1, 0, 2

 

#sidebar p:first-line the priority will be higher than #sidebar p#first 

Reference: http://coding.smashingmagazine.com/2009/08/17/taming-advanced-css-selectors/

Enable IIS Failed Request Tracing

Step 1: Enable windows feature :  Internet Information Services >  World Wide Web Services  > Health and Diagnostic > Tracing

Step 2: Open IIS Manage > Go to your site >  click 'Failed Request Tracing...’ on actions pane > Click 'enable'.

Step 3: In the features view, click 'Failed request tracing rules'.  Click add and choose your purpose like below :

a : Selected ‘All Content (*)’ , Status Code(s) : 200 

b:  Selected ‘ASP.NET (*.aspx) , Staus Code(s) : 401-999 , Event severity : Error

c:  Selected ‘Custome : *.js’ , Status Code(s) : 200

Step 4 : Look in c:\inetpub\logs\FailedReqLogFiles\w3svcX\

Enable USB debugging on android 4.2.X

1. Settings -> About Phone and scroll to the end

2. Tap on “Build Number” for 7 times.

3. Settings ->  Developer Option appear on your setting list now.

Check USB debugging > Ok