E # myid vs. #myid CSS Selectors

I'm curious what the difference is: b / w E # myid vs. # myid (E is any element), considering that there can only be one C # element on a page?

+3
source share
5 answers

This should be a mistake / mistake of you that #myiddoes not affect the item input. This works great for me.


How did you change your question:

You have two different documents that use the same stylesheet. In one document, the element DIVhas the identifier "foo", and in another document, the element SPANhas the same identifier. Then you can use the following stylesheet to style both elements:

#foo {
    color: #FFF;
}
div#foo {
    background-color: #F00;
}
span#foo {
    background-color: #0F0;
}

, .

+6

. , , , .

. , ( , ), :

1) "" ? "" : a) , ! important b) , ! important c) , ! important d) style = "" e) , ! f) , ! g) , ! important

2) #ids ? #ids ( , № 1).

3) .classes : ? .classes ( , ).

4) ? , .

5) , ? , . ( CSS ) ( <link> ed css "", <link> ed css ).

CSS. #id, , , , "" CSS, , , .

+1

, , . , , ( ) div , , span .

. , , - . . , , , css .

0

ID ...

, N (, < UL Id = MyList > < OL Id = MyList > ). javascript (.. UL, OL).

Not to say whether it will be a good design ... just to say that it is possible.

Edit: I mean that the server side can generate the page using OL> or> gt; UL> ... not at one time. Think of a dynamic web page. And again ... I do not say, anyway, if it is a good design ... just that it is POSSIBLE.

-1
source

Source: https://habr.com/ru/post/1703452/


All Articles