Need a help to get a good start with Nokogiri #css syntax.


I am learning "Nokogiri". But I am quite good Nokogiri's #xpath
technique.But wanted to learn also #css. So started to search online
materials to see how other writes a code using CSS techniques. Doing so
I got one interesting code as below:

But I am not comfortable with some notation used here,so thought if

anyone out there help me to redirect to a resource where I can learn

such techniques.

You need to read up on css selectors

My hard confusion is with the below lines:

***** β€œ#ires ol li” *****

  • when to write this way?

  • what # stands for? Looking at the source page I saw ires is one

id. – when I need to use such # and when .?

#foo finds an element with id foo whereas .foo finds an element with class foo. Which one to use depends on the markup.

  • Is there any other operators like # and . when using css?

Yes, there are a whole bunch, such as the pseudo selectors (:not, :nth-child), attribute selectors etc.

has fairly exhaustive info


Frederick Cheung wrote in post #1107477:

I am searching for a good example for the below method:


Any one out there,ever used these 2 methods. I need an example against
each,so your help will be much appreciated.


check out this reference: wrote in post #1110301:

check out this reference:

No Sir! I asked for the examples of the 2 methods,if any one ever used:

Nokogiri::XML::Node#fragment wrote in post #1110301:

check out this reference:

here is another link: