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

CSS specificity/order problem #11

Open
FilipXSv opened this issue Feb 10, 2024 · 0 comments
Open

CSS specificity/order problem #11

FilipXSv opened this issue Feb 10, 2024 · 0 comments

Comments

@FilipXSv
Copy link

Hi,

I have encountred problem I am not able to solve.
I have followed your first course of CSS and then experiment on it on topic of specificty and order of classes and figuring out what is being overriden and I encountered following behavior.

I created circle class that just says circle should be red. But it always overrides the second class, where the white is defined. Both classes (even in DevTools) have specificity (0, 1, 0) and so order should matter now - but its not for me. Here is the code snippet

/* HTML SNIPPET */

/* STYLES SNIPPET */
.canvas__circle {
height: 15px;
width: 15px;
border-radius: 50%;
position: absolute;
animation: fade-in 1s 1s backwards;
}

.circle--white {
background-color: #fff;
}
C:\ProjectsFila_bytegrad\SocialEditor\index.html
.circle--red {
background-color: rgb(255, 0, 0);
}

No other styles are interfering there (red is only specified in circle--red in my project).

Do you have any idea why I see such behavior? This is quite serious problem for me because I for example need to use in my react custom components <htmlElement className = {"myClassName " + this.props.className } but now I am not sure if the properties of custom styles will correctly override component default style.

Thank you in advance for any kind of help/advice.

Have a great day!
Filip

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