0

Hi eveeryoone,
Is it possible that span can have more the one id ?
i am tring like this

<span id="user Maxi">Maxi</span>
<span id="user John">John</span>
<span id="user Henry">Henry</span>
<span id="user Max">Max</span>
<span id="user Simon">Simon</span>

#user{
text-align:center;
display:inline-block;
width:50px;
height:20px;
background-color:#9B59B6;
margin:5px;
border:4px solid #3498DB;
color:#F1C40F;
cursor:pointer;
}

but it isnt working, why doesnt working css on this.

Edited by phoenix254

4
Contributors
3
Replies
32
Views
2 Years
Discussion Span
Last Post by Sam.Samual
0

An id is meant to be a unique identifier. You can't have two unique identifiers on the same span, or same anything.
You can use multiple classes however - .user, .Maxi, .John, etc. But you don't give any styles for your Maxi, John, Henry etc styles. So without them, there will be no visible change.

It's just possible that the browser is trying to apply the styles for the last id you use, and in each case there are no styles for that id.

0

Ids can't be used like this, use classes insted , id must be one word and must be unique.

<span class="user" id="Maxi">Maxi</span>
<span class="user" id="John">John</span>
<span class="user" id="Henry">Henry</span>
<span class="user" id="Max">Max</span>
<span class="user" id="Simon">Simon</span>

.user{
text-align:center;
display:inline-block;
width:50px;
height:20px;
background-color:#9B59B6;
margin:5px;
border:4px solid #3498DB;
color:#F1C40F;
cursor:pointer;
}

Edited by OsaMasw

0

you can use class for more than one entities. or you can use ajax for replacing the multiple ID

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.