Why the style is not applied to an individual element of the class? CSS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the style is not applied to an individual element of the class? CSS

why the style is not applied to an individual element of the class, but everything is in order with the rest. Checked no thoughts.

6th Jan 2020, 7:17 PM
Сотник Валентин
Сотник Валентин - avatar
11 Answers
+ 3
Can we see your code?
6th Jan 2020, 7:55 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Becouse your link to css style file was written twice (css.css and style.css). Where is situaded this file?
6th Jan 2020, 8:14 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
to avoid confusion, use while learning or only external styles (in the file), or only internal (setting them in the opening tag of each element)
6th Jan 2020, 8:18 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Use for one element style id http://htmlbook.ru/html/attr/id
6th Jan 2020, 8:30 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Good, then delete this line: <link rel="stylesheet" href="css/style.css">
6th Jan 2020, 8:47 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
And if your css.css is situated near html file (not in included folder css), write: <link rel="stylesheet" href="css.css">
6th Jan 2020, 9:19 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Yeah, you can: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="css/css.css" rel="stylesheet"> <link rel="stylesheet" href="css/style.css"> <title>Жить щасливо</title> </head> <body> <div class="overlay"> <nav class="overlayMenu"> <ul role="menu"> <li><a href="index.html" role="menuitem">Main</a></li> <li><a href="LiveHappy.html" role="menuitem">Live happy</a></li> <li><a href="#" role="menuitem">#</a></li> <li><a href="#" role="menuitem">#</a></li> <li><a href="#" role="menuitem">#</a></li> </ul> </nav> </div> <div class="navBurger" role="navigation" id="navToggle"></div> <div id="indent"> <h1>Как прожить жизнь щасливо?</h1> <h2>Принимай настоящее</h2> <ul class="text"> <li>Жить сейчас. Наслаждаться даром настояещего </li> <li>Никогда не приносит счастье в жертву достижениям </li> <li>Наслаждаться дорогой и проживать каждый день к
6th Jan 2020, 8:08 PM
Сотник Валентин
Сотник Валентин - avatar
0
body{ background-color: #C9FFBF; margin: 50; padding: 25; } A { text-decoration: none; } .mainHead{ font-size: 60px; text-align: center; background-color: red; display: inline-block; margin-left: 25%; margin-right: 25%; } .h2rules{ text-align: center; font-size: 35px; } .text{ font-size: 25px; } footer{ text-align: center; background-color: silver; } h1{ text-align: center; font-size: 45px; } #indent{ margin-left: 15%; margin-right: 15%; }
6th Jan 2020, 8:08 PM
Сотник Валентин
Сотник Валентин - avatar
0
just look that in the class the text does not change the size of the text in all elements
6th Jan 2020, 8:10 PM
Сотник Валентин
Сотник Валентин - avatar
0
so the problem is that the font size is applied to all elements of the "text" class, but not to 1 of them.
6th Jan 2020, 8:23 PM
Сотник Валентин
Сотник Валентин - avatar
0
It’s located in the same folder as CSS.css, but I just didn’t drop it to you, since it is intended for the menu.
6th Jan 2020, 8:27 PM
Сотник Валентин
Сотник Валентин - avatar