0

i have a html

 <span class="filter-option pull-left">Day</span>

now i want to select Day by CSSselector how can i do that ?

I can go upto span via

.btn.dropdown-toggle.selectpicker.btn-default>span

but how to specify Day to be selected?

vic
  • 217
  • 1
  • 7
  • 18
  • Why did you tag this question with XPath if you need a CSS selector answer? Also, you do not show enough of the HTML to make this question answerable. – Mathias Müller Feb 12 '16 at 09:19

1 Answers1

0

I guess that what you are trying to do is to apply some styles to the "Day" text. You can accomplish that by using an id or a class in your span element. For instance:

 <span id="my-id" class="filter-option pull-left">Day</span>

and then in you styles file use it in the way:

#my-id{
    /* some styles */
}

If what you want to do is get the content of the span("Day") it is not possible using just CSS, for that to work you'll need to use Javascript. This could help: Get value of Span Text

Community
  • 1
  • 1
melalonso
  • 228
  • 2
  • 9
  • If i dont want to use Javascript then only other option is Xpath ? How about if html has 2 span and want to select only first one ? select id="dob_day2" class="validate-dob validate-dob-day" data-title="Day" name="data[DateOfBirthDay]" autocomplete="off" style="display: none;">
    – vic Feb 12 '16 at 01:05