Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use child selectors not descendent selectors in CSS #34

Open
msmichellegar opened this issue Jun 19, 2015 · 0 comments
Open

use child selectors not descendent selectors in CSS #34

msmichellegar opened this issue Jun 19, 2015 · 0 comments

Comments

@msmichellegar
Copy link

when you are selecting children elements like here:

.feed-entry p {
font-size: 1rem;
text-align: justify;
padding: 1rem 3rem;
}

It is inefficient to do it like ".feed-entry p" as the selectors are read right to left. This means all 'p' elements will first be searched for first, which is very inefficient.

INSTEAD, use child selectors like this : ".feed-entry > p". The '>' indicates that you want the child element of '.feed-entry' and it will read left to right, so it narrows the element down faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant