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

Hi,

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.

https://developer.mozilla.org/en-US/docs/CSS/Getting_Started/Selectors

has fairly exhaustive info

Fred

Frederick Cheung wrote in post #1107477:

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

Nokogiri::XML::Node#matches?
(http://www.rubydoc.info/gems/nokogiri/frames)
Nokogiri::XML::Node#fragment
(http://www.rubydoc.info/gems/nokogiri/frames)

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

Thanks

check out this reference:

http://www.w3schools.com/cssref/css_selectors.asp

gerry.jenkins@gmail.com wrote in post #1110301:

check out this reference:

http://www.w3schools.com/cssref/css_selectors.asp

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

Nokogiri::XML::Node#matches?
Nokogiri::XML::Node#fragment

gerry.jenkins@gmail.com wrote in post #1110301:

check out this reference:

http://www.w3schools.com/cssref/css_selectors.asp

here is another link:
http://reference.sitepoint.com/css/pseudoclass-firstoftype