简体   繁体   English

设置页面背景色

[英]Setting page background-color

Im trying to set a page background-color in desktop.我试图在桌面上设置页面背景颜色。

Tried.试过了。

<html>
<head>
<title>
webpage
</title>
</head>
<body style="background- 
color:black;text- 
align:center">
welcome to my page
</body></html>

And

#doc3 {
margin: auto 10px;
width: auto;
height: 2000px;
background-color: yellow;

} }

And

 @media (min-width: 768px){ 
 body, html.page-id-28 
 {background-color:green 
 !important;height: 2000px;

 }}

And

@media (min-width: 768px){ 
body.page-id-28 {background- 
color:black;
}}

And

@media (min-width: 768px){ 
body, html.page-id-28 
{background-color:black 
!important;}} 

Nothing.没有。

here这里

The page flashes once, and then reverts to white.页面闪烁一次,然后恢复为白色。 At best I've managed to change half the body color, but not whole thing.充其量我设法改变了一半的身体颜色,但不是全部。

Add this into the head of the page like so像这样将其添加到页面的头部

<head>
    <title>webpage</title>
    <style>
        body {
            background-color: lightblue;
        }
    </style>
</head>

Anything you add into this style block will apply to everything in the body of the whole document.您添加到此样式块中的任何内容都将应用于整个文档正文中的所有内容。 It is better to do this than put it inside the body tag as this will go right to the edge of the screen and it is easier to read.这样做比将它放在 body 标签中更好,因为这将直接到达屏幕边缘并且更易于阅读。

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

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