Reputation: 43
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.
Upvotes: 0
Views: 1237
Reputation: 3964
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>
Upvotes: 1
Reputation: 92735
Try
[name='three'] {
color: red
}
<p name="three">x</p>
Upvotes: 1