CSS: Is There Any Difference Between These Two Parts

CSS: Is there any difference between these two parts?

The problem was in the one mystic character (on line 81 on the screenshot). I've only been not using an option 'Show invisible characters' in my code editor.

CSS with invisible characters



I've removed this character and the problem was solved. I don't really know, how this character (ASCII 0x8 (“backspace”)) appeared here.

Thank you all the people who responded on this question and advised different solutions.

UPD: I've created the related question, about putting 0x08 character on MacBook into a text: How can I put 0x08 ascii character using MacBook?

CSS whats the difference between these two

The way to solve the CAPS in the CSS is a simple meta tag in the head.the caps in the script came from Quirks-mode. to stop the IE browser to use this mode use the meta tag shown here

<!-- Enable IE9 Standards mode -->
<meta http-equiv="X-UA-Compatible" content="IE=9" >

Is there a difference between these two CSS selectors?

Would the following CSS selectors select the same elements?

No they don't. Notice how in the below example the last element isn't selected by ul>li[class="a"] because that selector will select element having only a as a class.

 ul>li.a {  color: red;}
ul>li[class="a"] { font-size: 30px;;}
 <ul>    <li class="a">Item 1</li>    <li>Item 2</li>    <li class="a b">Item 3</li>  </ul>

Optimal Way To Differentiate Between Exactly Two Elements with CSS

From what I've seen (even though it makes the code longer) the first way is the best way to approach it in the long run, even though for the time being both ways work perfectly fine. The code is short enough as it is so the extra id attributes shouldn't be too long, and if you decide to change your page with more sections down the road, you will have a lot less editing to do within your css to maintain your existing sections.

EDIT: I should say that classes tend to be more widely accepted than ids, but both will do the trick for you. Classes would make it easier for you to style sections exactly the same way you would style these sections down the road, if you would like to do that.

Difference between these two CSS selectors

Consider the following HTML:

<div>
<p>1</p>
<p>
<p>2</p>
<p>3</p>
</p>
<p>4</p>
</div>
<p>5</p>

div > p will only select direct descendants: 1, 4 and the one with the p elements nested in it.

div p will select all p tags within a div: 1 2 3 4.

whats the difference between these two css selectors?

The (space) in CSS selectors is the "descendant selector."

  1. Selects an element with ID child-div that has an ancestor of parent-div
  2. Selects an element that has an id of both parent-div and child-div (which is impossible)

Just for fun: parent-div#child-div is a valid ID, but as part of the CSS syntax you have to escape the # in the ruleset:

http://jsfiddle.net/ExplosionPIlls/xdWNV/1/

Is there a difference between these two CSS notations for applying a style to a certain class?

Yes, there is a difference between them.

.ClassName a:hover refers to any hovered anchor that is within an element with class="ClassName".

a.ClassName:hover, however, refers to any hovered anchor that has class="ClassName".

There is lots of information regarding CSS Selectors at W3.org.



Related Topics



Leave a reply



Submit