html - Need equivalent CSS Selectors of an XPATH expression -


i have html code below :

 <div id="select_a_boundary" class="dataset_select2">homes name</div> 

i wrote xpath expression same:

 //div[@id = 'select_a_boundary' , @class = 'dataset_select2'] 

what equivalent css selectors same?

first of if using id, don't require use class, secondly if willing yo select element id select_a_boundary can use

#select_a_boundary {    /* styles goes here */ } 

demo

note: not selecting element has id , class here, id sufficient has unique, if using id multiple elements it's invalid


as per comment

div[id=select_a_boundary][class=dataset_select2] {     color: red; } 

demo x-path equivalent

or easier 1 (credits: jack)

#select_a_boundary.dataset_select2 {     color: red; } 

note: still recommend use #select_a_boundary more enough


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -