2015-07-15 6 views
-1

У меня возникла проблема с красным элементом элемента, применяя два класса к нему с помощью функции «! Important». Это упражнение на курсе программирования. Любая помощь будет принята с благодарностью. Мой код выглядит следующим образом.! Важный атрибут атрибута не работает

<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'> 
 
<style> 
 
    .red-text { 
 
    color: red; 
 
    } 
 
    
 
    .urgently-red { 
 
    font-color: red !important; 
 
    } 
 
    
 
    .blue-text { 
 
    font-color: blue; 
 
    } 
 

 
    h2 { 
 
    font-family: Lobster, Monospace; 
 
    } 
 

 
    p { 
 
    font-size: 16px; 
 
    font-family: Monospace; 
 
    } 
 
</style> 
 

 
<h2 class='urgently-red blue-text'>CatPhotoApp</h2> 
 

 
<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p> 
 
<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

+0

'font-color' недействителен, измените его на просто' color'. Если вы поместите '.urgently-red' после' .blue-text', он должен иметь приоритет. –

ответ

0

Заменить

.red-text { 
    color: red; 
    } 

    .urgently-red { 
    font-color: red !important; 
    } 

    .blue-text { 
    font-color: blue; 
    } 

    h2 { 
    font-family: Lobster, Monospace; 
    } 

    p { 
    font-size: 16px; 
    font-family: Monospace; 
    } 

С

.red-text { 
    color: red; 
    } 

    .urgently-red { 
    color: red !important; 
    } 

    .blue-text { 
    color: blue; 
    } 

    h2 { 
    font-family: Lobster, Monospace; 
    } 

    p { 
    font-size: 16px; 
    font-family: Monospace; 
    } 

Изменения: font-color в color

+0

Ах, это отбросило меня, потому что по ходу он отбросил эту часть, как будто я сделал это правильно. Спасибо, я знал, что это будет простое решение. –

Смежные вопросы