Как мне изменить цвет моего текста в css? - PullRequest
0 голосов
/ 14 апреля 2020

Я хочу изменить цвет двух разных типов описаний. Я хочу, чтобы текст для двух разных описаний отображался двумя разными цветами. Я хочу, чтобы текст описания сайта отображался фиолетовым цветом, а текст резюме музыканта под именем каждого исполнителя - ярко-розовым.

    <!DOCTYPE html>
<html>
<body>
<head>
<title>My Music Website</title>
<style>
.musician-summary{
  color: blue;
}
#site-description{
  color: red;
}
</style>
</head>
</body>
<h1>My Music Website</h1>
<p id="site description"> Check out some of my favorite musical artists 
from around the world.</p>
<hr>
<h2 class="musician title">Stephane Wrembel</h2>
<p class="musician summary">His biggest influence and
  inspiration is Django Reinhardt. His music
is in the style of gypsy jazz. He learned
how to play directly from gypsies while living
with them for a few years.
Mysticism is a big theme in much of his
music. He plays many French standards
and his own compositions.</p>

<h2 class="musician title">Bjork</h2>
<p class="musician summary">Bjork has always shown a musical ability.
At the age of 11 she recorded her first album.
She gained fame outside of her country in the Icelandic punk band
The Sugarcubes, and later on went solo.
Her solo music is very ecclectic.
It ranges from hip-hop with some rhythms, classical, electronic, and she 
has been dubbed as the queen
of trip hop due to her use of hip hop beats.</p>

<h2 class="musician title">Sima Bina</h2>
<p class="musician summary">In Iran she is called Maestra Sima Bina. Her 
music is played in styles that are from and around Iran.</p>

1 Ответ

1 голос
/ 14 апреля 2020

Ваш CSS селектор и класс / ID в HTML отличаются; у вас есть пробел по ID и классу, и вы используете - в HTML. Установите свой класс и ID с тем же именем, что и в CSS; musician-summary и site-description. Кстати, если вы используете пробел в именах классов или идентификаторов, он создает 2 класса / идентификатора

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...