Hi all,
I have a webpage containing CSS styling. I know how to use Nokogiri to
extract webpage containing html tags. But not sure if the page contains
CSS styling tags. I wonder if someone out there can give me a clue on
this.
In this simple demo, I want to know which font color is set to these
three classes ft0 ft4 ft5. Then return all classes with font color
set to red.
I can return the name of each class, but I am not sure how to find out
what font color is inside that class.
Thanks in advance,
#3/28/2017
#color:red;
require ‘nokogiri’
require ‘pp’
html=DATA.read
doc = Nokogiri::HTML(html)
doc.search(‘span’).each{|tag| puts cl=tag.attr(‘class’) }
END
Page 29–>
ruby find_hightlight-tag.rb
ft0
ft4
ft5
Exit code: 0