Is it okay to do this?
<link rel="stylesheet" href="css/mobile/load.css" id="stylesheet_mobile" />
so I can use JavaScript to dynamically disable stylesheets?
Yes, you can. But note that Id's must be unique within your html file, while classes can be used in multiples elements.
Your HTML there is fine. You can specify a class and an id on the same element.
To add a class on click of anchor tag, we use addClass() method. The addClass() method is used to add more property to each selected element. It can also be used to change the property of the selected element.
The basic rule that you need to keep in mind while using classes and ids in CSS is that, id is used for single elements that appear on the page for only once (e.g. header, footer, menu), whereas class is used for single or multiple elements that appear on the page for once or more than once (e.g. paragraphs, links, ...
According to HTML 4.01 Transitional, id
, class
are document-wide selectors, and thus it is ok to have them in the link
element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With