0

Now this might be a dumb question and if so I sincerely apologise for wasting your time.

I was wondering how one was to call an HTML object with the 'name' tag. Here an example to explain what I mean:

HTML: <p id="one"></p>
CSS: #one{}

HTML: <p class="two"></p>
CSS: .two{}

HTML: <p name="three"></p>
CSS: ?

I need this because I'm working with commercial JavaScript UI components and they have a naming system based on name.

Thank you for taking the time to answer.

Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345

3 Answers3

1

Try

[name='three'] {
  color: red
}
<p name="three">x</p>
Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
1

Use CSS attribute selector. p[name] css will affect all your <p></p> element with name attribute.

p[name] {
  background: green
}

p[name="three"] {
  background: red
}
<p name="two">text</p>

<p name="three">text</p>
Karuppiah RK
  • 3,894
  • 9
  • 40
  • 80
1
p[name="three"] { color:red }

you can select css by attribute tag

kk kk
  • 309
  • 4
  • 10