Hoffman Foundation Scholarship!
Hoffman Foundation Scholarship!
Empowering 2,000 African Youth with World-Class Education! this program provides grants of $600–$1,500
Apply Now

Html-CSS

By Fredericks Hamunyera in 14 Aug 2024 | 21:08
Fredericks Hamunyera

Fredericks Hamunyera

Student
Faithful User
Forums Top User
Posts: 3
Member since: 7 Dec 2023

i'm working through a css course, and for some reason i have .item p for a class. i'm guessing p means that the item class only apply to paragraphs, but im not sure?




14 Aug 2024 | 21:08
0 Likes
Ubah Pascal

Ubah Pascal

Student
Loyal User
Posts: 2
Likes: 1
Member since: 7 Jul 2024

.item p will look for a paragraph inside an element that has class "item" Example

<div class="item"> <p>Some Text</p> </div>

If you wanted to apply style to a p tag that has specific class it would then be p.yourclass This would match


<p class="yourclass"></p> but not <div class"yourclass"></div>

14 Aug 2024 | 21:11
1 Likes
Fredericks Hamunyera

Fredericks Hamunyera

Student
Faithful User
Forums Top User
Posts: 3
Member since: 7 Dec 2023
quote-right
Reply to Ubah Pascal

.item ...

so p.yourclass would be more selective than just .yourclass p? p.yourclass would apply to only p tags with the yourclass class, and .yourclass p would apply to all p tags in said area?

14 Aug 2024 | 21:14
0 Likes
Ubah Pascal

Ubah Pascal

Student
Loyal User
Posts: 2
Likes: 1
Member since: 7 Jul 2024
  1. Yeah. That's right. If you would do p.yourclass it would look for a p tag with this class, but if you had a space between p .yourclass it would look for an element with class yourclass inside a paragraph
  2. Also, instead of doing
    margin-left:auto; margin-right:auto;
    You can just do
    margin-inline:auto;
    This is called a "Logical Property" you should take a look at other logical properties. margin-inline is margin on left and right, margin-block is margin on top and bottom but margin-inline and margin-block is also shorthand properties. margin-inline is shorthand for margin-inline-start which is left margin and margin-inline-end which is right margin. but margin-inline would not really make a difference since it puts the same margin on both sides. And let's say you want 10px margin on left and 20px margin on right, you could do margin-inline:10px 20px; instead of using both margin-inline-start and margin-inline-end
14 Aug 2024 | 21:17
0 Likes
Fredericks Hamunyera

Fredericks Hamunyera

Student
Faithful User
Forums Top User
Posts: 3
Member since: 7 Dec 2023
  1. thank you for the help!
14 Aug 2024 | 21:21
0 Likes

Report

Please describe about the report short and clearly.

GDPR

When you visit any of our websites, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and manage your preferences. Please note, that blocking some types of cookies may impact your experience of the site and the services we are able to offer.