It seems to me that this should work if you can tell #foo p: first-child why #foo hr: first-child does not work. If anyone can explain this, I would really appreciate it.
I installed a JSFiddle demo here - http://jsfiddle.net/mGu7x/6/
None of the <hr> elements are the first parent of their parent element.
<hr>
Watch this updated demo that makes the border more obvious and moves hr up.
You might want to look :first-of-type , which is new in CSS 3 and does what you are looking for. (Can I use offers so that it has broad support outside of non current IE).
:first-of-type
See the demo with :first-of-type (which I tested only in Chrome).
Because #main first-child is p , not hr .
#main
first-child
p
hr
You can use nth-child , though:
#main hr:nth-child(2) { border-bottom: 3px solid green; }
Source: https://habr.com/ru/post/924783/More articles:.Net webApi ISO datetime and IE8 - javascriptIs the fixed array size O (n) or O (1) in space? - arraysHow can I vertically offset a bullet or content in CSS? - htmlHow to handle a Generic type object with protocol buffers in a .proto file? - objectwordpress the_content parsing outside the loop - functionIs bad form to try and not interact with each other classes other than main / form1? - c #MVC 3 validation: want my shortcuts to be red that correspond to controls that fail validation - asp.net-mvc-3What is a TDD book for C # with Mocks processing - c #JavaMail - javax.mail.MessagingException - javaRead the CSS file with Javascript and dynamically change the page - javascriptAll Articles