背景里面一个背景 [英] Background Inside a Background
问题描述
我一直trynig把背景放在我的网站后台里面。我能够把我想要这个code中的背景色:
<车身的bgcolor =#F5F2D4>
< DIV CLASS =画廊>
< H1>画廊< / H1>
< / DIV>
< /身体GT;
之后,在CSS中我做了以下
H1名为.gallery {
文本对齐:中心;
FONT-FAMILY:'世纪的哥特式,CenturyGothic,AppleGothic,无衬线;
字体大小:55像素;
字体风格:正常;
字体变形:正常;
字体重量:500;
行高:26.3999996185303px;
背景颜色:白色;
}
背景会是这个样子(B =米色,W =白:
-------------------------
| BB | WWWWWWWWWWWWWWWWWW | BB |
| BB | WWWWWWWWWWWWWWWWWW | BB |
| BB | WWWWWWWWWWWWWWWWWW | BB |
| BB | WWWWWWWWWWWWWWWWWW | BB |
| BB | WWWWWWWWWWWWWWWWWW | BB |
-------------------------
此制成我在背景想要的颜色,但它是不进行缩放。它只有从直到白启动浏览器的边框差几个像素,有没有什么办法,使距离的增加?
此外,有没有什么办法,使白色背景滚动一路下跌?
非常感谢你。
输入 HTML
,体
和名为.gallery
全部高度:100%
,使名为.gallery
占据屏幕的整个高度。
如果你想在名为.gallery
有一个固定的宽度(如下面的例子),给它一个宽度
添加保证金:0汽车
将它横向中心本身在屏幕上。如果你不希望它有一个固定的宽度增加填充:0 100px的
在体
如果你想有从左侧和右侧的名为.gallery
来为米色
HTML,\r
身体 {\r
高度:100%;\r
}\r
\r
身体 {\r
背景颜色:米色;\r
保证金:0;\r
}\r
\r
{名为.gallery\r
背景颜色:白色;\r
宽度:960像素;\r
保证金:0汽车;\r
高度:100%;\r
}
\r
< DIV CLASS =画廊>\r
< / DIV>
\r
I have been trynig to put a background inside a background on my website. I was able to put the background color that I wanted with this code:
<body bgcolor="#F5F2D4">
<div class="Gallery">
<h1> Gallery </h1>
</div>
</body>
After, in CSS I did the following
.Gallery h1 {
text-align: center;
font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif;
font-size: 55px;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 26.3999996185303px;
background-color: White;
}
The background would look something like this (B=Beige, W=White:
-------------------------
|BB|WWWWWWWWWWWWWWWWWW|BB|
|BB|WWWWWWWWWWWWWWWWWW|BB|
|BB|WWWWWWWWWWWWWWWWWW|BB|
|BB|WWWWWWWWWWWWWWWWWW|BB|
|BB|WWWWWWWWWWWWWWWWWW|BB|
-------------------------
This made the colors that I wanted in the background, but it is not scaled. It only has a few pixels of difference from the border of the browser until the White starts, is there any way to make the distance increase?
Also, is there any way to make the White Background scroll all the way down?
Thank you very much.
Give the html
, body
and .gallery
all a height: 100%
to make the .gallery
take up the entire height of the screen.
If you want the .gallery
to have a fixed width (as in the example below) give it a width
and add margin: 0 auto
to have it center itself horizontally in the screen. If you don't want it to have a fixed width add a padding: 0 100px
on the body
if you want to have 100 pixels from the left and right side of the .gallery
to be beige.
html,
body {
height: 100%;
}
body {
background-color: beige;
margin: 0;
}
.gallery {
background-color: white;
width: 960px;
margin: 0 auto;
height: 100%;
}
<div class="gallery">
</div>
这篇关于背景里面一个背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!