I have been trying to save the CSS code and save the file as .css in the same folder and i link it on my html but when i do that the code doesn't get inserted to the document. Is there any specific way to save external .css? because right now i am saving all the code in that html that is css and saving that as .css and link it but it is not working.

www.insanecricket.com/sleek

Dani AI

Generated

Good catch by and thanks to for confirming the fix. For anyone else who runs into a stylesheet that "does nothing," the symptom in this thread (link markup accidentally placed inside a style wrapper) is common — but there are a few other, less obvious causes worth checking before assuming the stylesheet itself is broken.

First, confirm the browser can actually fetch the .css file: open its URL directly and watch the Network panel in DevTools for the request status and the Content-Type header. Look for 200 vs 404/403, unexpected redirects, or a server returning text/html instead of text/css. Also check the Console for MIME or CSP errors. Ensure the .css file contains only CSS (no HTML wrappers, server-side templates, or stray characters such as a UTF-8 BOM). Remember that filenames on many hosts are case-sensitive and that relative URLs inside CSS (for images or fonts) are resolved relative to the CSS file, not the HTML page. If changes do not appear, try a hard refresh or a cache-busting query string.

For general best practice: place the stylesheet link in the document head with rel set to stylesheet, validate the stylesheet for syntax issues, and use the browser inspector to see whether rules are being loaded but overridden (specificity, order, or !important). Useful references: MDN on the HTML link element (HTML <link> element), MDN on MIME types (MIME types), and the W3C CSS validator (Jigsaw Validator).

Recommended Answers

All 2 Replies

External css should not contain style tags (<style type = "text/css"></style>) at the beginning and end like they do when putting them inline. If the styles aren't showing up, they probably aren't in the same place that you are pointing the link href to. Try typing the absolute address of your css file into the browser and view it to make sure it's there. Then copy and paste the same url into the href. i.e.<link href="http://www.insanecricket.com/sleek/styles.css" rel="stylesheet" type="text/css" />

commented: Good spoting +7

External css should not contain style tags (<style type = "text/css"></style>) at the beginning and end like they do when putting them inline. If the styles aren't showing up, they probably aren't in the same place that you are pointing the link href to. Try typing the absolute address of your css file into the browser and view it to make sure it's there. Then copy and paste the same url into the href. i.e.<link href="http://www.insanecricket.com/sleek/styles.css" rel="stylesheet" type="text/css" />

thanks a lot i was putting the link rel inside the style tags thats why it wasnt working thanks a lot.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.