CSS styling not updating
-
I am a student taking basic html & CSS. Two weeks ago I downloaded notepad++ to my laptop and it’s working great. Last week I bought a new computer and installed notepad++8.3.3. The html works great, but CSS isn’t translating. I went through the new installation with my instructor (40-years experience) and he couldn’t figure out why. It doesn’t matter if I embed the code or use an external style sheet. In the following example, just trying to set the background color red and the body text yellow. Also tried to test an external style sheet, but that didn’t work either.
<!DOCTYPE html> <html lang="en"> <head> <title>Trillium Media Design</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="test.css"> <style> body {background-color: #ff0000; color: #ffff66;} </style> </head> <body> <header> <h1>Trillium Media Design</h1> </header> <nav><a href="index.html">Home</a> <a href="services.html">Services</a> <a href="contact.html">Contact</a> </nav> <main> <h2>New Media and Web Design</h2> <p>Trillium Media Design will bring your company’s Web presence to the next level. We offer a comprehensive range of services:</p> <ul> <li>Website Design</li> <li>Interactive Animation</li> <li>E-Commerce Solutions</li> <li>Usability Studies</li> <li>Search Engine Optimization</li> </ul> <h2>Meeting Your Business Needs</h2> <p>Our expert designers will listen to you as they create a website that helps to promote and grow your business.</p> </main> <footer> Copyright © 2020 Your Name Here </footer> </body> </html>
—
moderator added code tags to make the question readable -
If you are saying that your HTML+CSS is not working in your browser, that is not an issue with Notepad++ (the editor that you are using), it is an issue with your HTML or CSS.
Notepad++'s responsibility ends the moment it writes the file you typed to the disk. And I am quite certain it has written that correctly. The contents are up to you, and getting them to render correctly in a web browser is up to you.
But just so that you know, the HTML+CSS you posted works as expected:
So there is no problem with Notepad++ (since the file was saved correctly, since you could post it to us); the HTML+CSS works correctly in a reasonable browser. So the problem exists solely on your end in the rendering: my guess is you were not loading the file that you had saved in your browser, but some other older file that hadn’t been edited yet; either that, or you have a broken browser. That said, further debugging should be on your machine, and in forums relevant to the browser you are using or the OS you are using, because the text editor did it’s job correctly, and there’s no reason to ask the text editor experts what’s going wrong.
-
@bob-bloom said in CSS styling not updating:
<!DOCTYPE html>
<html lang=“en”>
<head>
<title>Trillium Media Design</title>
<meta charset=“utf-8”>
<link rel=“stylesheet” type=“text/css” href=“test.css”>
<style>
body {background-color: #ff0000; color: #ffff66;}
</style>
</head>
<body>
<header>
<h1>Trillium Media Design</h1>
</header>
<nav><a href=“index.html”>Home</a>
<a href=“services.html”>Services</a>
<a href=“contact.html”>Contact</a>
</nav>
<main>
<h2>New Media and Web Design</h2>
<p>Trillium Media Design will bring your company’s Web presence to the next level.
We offer a comprehensive range of services:</p>
<ul>
<li>Website Design</li>
<li>Interactive Animation</li>
<li>E-Commerce Solutions</li>
<li>Usability Studies</li>
<li>Search Engine Optimization</li></ul>
<h2>Meeting Your Business Needs</h2>
<p>Our expert designers will listen to you as they create a website that helps to promote
and grow your business.</p>
</main>
<footer>
Copyright © 2020 Your Name Here
</footer>
</body>
</html>Hi: Welcome to the fun world of HTML & CSS coding.
I have had similar problems when I forget to refresh the page in my browser so as to make sure it is getting the latest edited copy and not the cached copy.
In addition, your code validates 100% using the W3C validator. I do not use Notepad++ to write my code. Instead, I use a dedicated editor like CoffeeCup’s (CC) HTML editor. Free and premium versions are available. (Not an endorsement for and CC product)
-
@ron-payne-0 said in CSS styling not updating:
I do not use Notepad++ to write my code. Instead, I use ___
This forum is not for proselytizing for other text editors. You are free to use whatever text editor you want, but this forum focuses on Notepad++. Please confine your answers in this forum to the way it would be done inside Notepad++ – and as editing HTML is something that Notepad++ can easily handle, there is no reason in this forum to bring up anything else.
-
@peterjones I mentioned what I used so as the person would know what I used to look at his code. It’s also why I made it clear that the name had nothing to do with an endorsement. You need to lighten up as we all know this forum is about Notepad++ which I have used for over 10 years. No need to make a public display of dressing me down. A polite personal message would have been fine.