简体   繁体   English

背景颜色不会更改CSS样式表

[英]Background color doesn't change CSS Style sheet

 body { background-color: bisque; } 
 <!DOCTYPE html> <html> <head> <title>Reading</title> </head> <body> <h1> <button><a href="index.html">Home</a></button> <button><a href="reading.html">Reading</a><br/></button> <button><a href="coffee.html">Coffee</a></button> </h1> <div> <h1>I usually drink three to four cups of coffee on weekdays</h1> <img src="cof1.JPG" height="171" width="294" alt="Coffee"/> <img src="cof2.JPG" height="168" width="300" alt="Coffee"/> <h2>Some of my favorite coffees are: </h2> <OL> <LI> Cafe Crema</LI> <LI>Yaucono</LI> <LI>Arabigo</LI> <LI>Cafe Lareño</LI> <LI>Mami</LI> </OL> </div> </body> </html> 

I have tried many styles to see what's wrong, but I can't seem to change the background color. 我尝试了多种样式来查看出了什么问题,但是我似乎无法更改背景颜色。 This webpage works, but it's just plain. 该网页可以使用,但是很简单。 I am required to use CSS in order to compare both styles. 我需要使用CSS才能比较两种样式。

我复制并粘贴了您的代码,它的工作正常,我想问题是您没有刷新页面,尝试执行硬重载CTRL + F5或在Mac Command + R中

It actually does. 确实可以。 I edited your question so it should be a snippet, and it worked in your source too. 我编辑了您的问题,因此应该是一个摘要,它在您的源代码中也起作用。 The only change I made was to change the p tag into div tag since p tag is meant for a paragraph, and what you wanted is a block. 我所做的唯一更改是将p标签更改为div标签,因为p标签用于一段,而您想要的是一个块。

Look how I changed the background color to blue: 看看我如何将背景色更改为蓝色:

 body { background-color: blue; } 
 <!DOCTYPE html> <html> <head> <title>Reading</title> </head> <body> <h1> <button><a href="index.html">Home</a></button> <button><a href="reading.html">Reading</a><br/></button> <button><a href="coffee.html">Coffee</a></button> </h1> <div> <h1>I usually drink three to four cups of coffee on weekdays</h1> <img src="cof1.JPG" height="171" width="294" alt="Coffee"/> <img src="cof2.JPG" height="168" width="300" alt="Coffee"/> <h2>Some of my favorite coffees are: </h2> <OL> <LI> Cafe Crema</LI> <LI>Yaucono</LI> <LI>Arabigo</LI> <LI>Cafe Lareño</LI> <LI>Mami</LI> </OL> </div> </body> </html> 

也许页面没有刷新正确

PRESS Ctrl + F5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM