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

问题描述 投票:0回答:3

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来比较两种风格。

html css background-color
3个回答
1
投票

我复制并粘贴你的代码,它的工作正常,我猜问题是你没有刷新页面尝试重新加载CTRL + F5或在mac命令+ R


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>

0
投票

也许页面没有令人耳目一新

PRESS Ctrl + F5
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.