kepler Posted October 21, 2021 Share Posted October 21, 2021 Good evening, How can I apply the W3.css stylesheet/lib to a specific and only section in an HTML page, like a div? What is the best approach? I ask because loading the CSS file messes with the formatting of some pages completely. Thank you. Kepler Link to comment Share on other sites More sharing options...
niche Posted October 21, 2021 Share Posted October 21, 2021 (edited) You're referring to selectors in CSS https://www.w3schools.com/css/css_selectors.asp EDIT: Just match your selectors to your stylesheets. It can be challenging to do that when using someone else's code depending on available documentation and a person's ability to read code. Edited October 21, 2021 by niche Link to comment Share on other sites More sharing options...
kepler Posted October 22, 2021 Author Share Posted October 22, 2021 Hi niche, Sorry for the late reply. So, must I - in the w3.css - place in the top "#myCode {" and at the end "}", and apply it to a div with ID name equal to "myCode"? Or apply it to each one (#myCode w3-content... #myCode w3-image... for example)? My problem are the "global" selectors, like html, body, input[type=button], etc. on w3.css. What is your opinion? Thanks. Kepler Link to comment Share on other sites More sharing options...
niche Posted October 22, 2021 Share Posted October 22, 2021 (edited) That's always answered by a selector's proximity to an element. The closest selector gets the last word, in simple situations outlined in the "All CSS Simple Selectors", in the link from my original post. EDIT: Extreme example: inline css over rides all selectors. Edited October 22, 2021 by niche Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now