How to put a CSS inside the html tag with URL?

1

I have this CSS that I would like to put in my form

<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

However, when I put in <head> the CSS of the entire page is changed (obviously that would happen).

How do I import this CSS only for the tag <form> ?

    
asked by anonymous 27.06.2017 / 16:39

1 answer

3
  

Suddenly if you put your css after that of w3 it might work due to the priority in css. It CAN BE and will not necessarily BE.    "have those declared last"

Styles Priority (cascade)

In some cases you can specify different styles for the same page by combining a ".css" file referenced in a link or by inserting a style tag, and also with inline style attributes. If these different specifications conflict with each other, the browser has to decide which values to use. This choice is made on the basis of a cascading style sheet.

This order of priority looks like this:

  • default
  • Browser
  • External CSS (".css" file)
  • Internal CSS (within the tag)
  • Inline styles (within the HTML element)
So an inline style has the highest priority within the cascade, which means that it will override any style declared within the tag, in an external .css file, and in a browser (value default).

SOURCE

  

Ideally, you should incorporate into your style sheet only the parts of the css that you want to use in your form as our friend alan said in the comment and will only bring benefits to you.

When a person first enters the site, the first few seconds are critical to grab the attention and convince them to stay for a while or to come back in the future. If your site takes a long time to load, most people give up and quit even before they have had a chance to show you the value of their service. "A one-second delay can result in 7% fewer conversions, 11% less pageviews, or even a 16% decrease in customer satisfaction" BRYAN EISENBERG .

Clean code means faster loading and happy visitors.

It's important to keep loading time down by writing semantically-appropriate code, using best practices for performance optimization and routinely cleaning CSS, HTML, and images.

Generally, the loading time of the site will increase with its evolution and this, in a way, is something already expected. That's why it's important to make this HTML, CSS and image cleanup routine a natural part of the workflow to ensure a positive user experience.

    
27.06.2017 / 16:54