6
Given my and html
and css
respectively:
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<head>
<link rel="stylesheet" type="text/css" href="css/estilos.css">
<title>Teste</title>
</head>
<body>
<!--<font color="red"><b><i>FIRE</i></b></font>-->
<div class="tipoPokemon">
Tipo <span id="fire">Fire</span><br>
Tipo <span id="water">Water</span><br>
</div>
</body>
</html>
CSS:
.tipoPokemon #fire{
color: red;
text-transform: uppercase;
font-weight: bold;
font-style: italic;
}
.tipoPokemon #water{
color: blue;
text-transform: uppercase;
font-weight: bold;
font-style: italic;
}
The idea is the following: Format specific words in the text, note that it only changes if the color in the example. My question is: Can you group the 3 repeating attributes and make a color-only switch ? Ex: Declare the 3 attributes as global and vary only colors.
It worked, just a doubt: because the span is close to the # and there is no space ?
– Roknauta
@Separate Douglas means that one element is inside another, so the element
#fire
would need to be a descendant ofspan
, while together, it means that it is the same element, so thespan
need to haveid=fire
– Tobias Mesquita
Show, thank you very much.
– Roknauta
@Douglas also made an example with SASS, you may come to like.
– Tobias Mesquita
God, I liked the idea, I didn’t know the SASS, I’ll study it and thank you.
– Roknauta