Jump to content

Apply W3.css to a section only


kepler

Recommended Posts

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

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 by niche
Link to comment
Share on other sites

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

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 by niche
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...