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

时间:2018-09-15 20:17:40

标签: html css background-color

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>

我尝试了多种样式来找出问题所在,但似乎无法更改背景颜色。该网页可以使用,但是很简单。我需要使用CSS才能比较两种样式。

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

实际上是这样。我编辑了您的问题,因此应该是一个摘要,它在您的源代码中也起作用。我所做的唯一更改是将p标记更改为div标记,因为p标记用于一个段落,而您想要的是一个块。

看看我如何将背景色更改为蓝色:

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>

答案 2 :(得分:0)

页面可能刷新不正确

PRESS Ctrl + F5