Css 背景停止,我试着使用repeat和anything以及我找到的所有东西

Css 背景停止,我试着使用repeat和anything以及我找到的所有东西,css,image,background,Css,Image,Background,我正在尝试创建一个医生办公室的网站,我希望它看起来尽可能专业,但我的背景图像(梯度图像)将停止,不会重复。我尝试了repeat-y,repeat-x,但没有使用它,因此它可以重复两次,但没有任何效果 代码: 链接 自卫队 自卫队 自卫队 自卫队 自卫队 sdfsdfs img{ 位置:绝对位置; 保证金:自动; 顶部:4000px; 底部:1000px;; 左:0; } .顶{ 位置:绝对位置; 左:0;右:0; } .左{ 背景图片:url(“文件:/C:/Users/cody/Deskto

我正在尝试创建一个医生办公室的网站,我希望它看起来尽可能专业,但我的背景图像(梯度图像)将停止,不会重复。我尝试了
repeat-y
repeat-x
,但没有使用它,因此它可以重复两次,但没有任何效果

代码:


链接

自卫队 自卫队 自卫队 自卫队 自卫队 sdfsdfs img{ 位置:绝对位置; 保证金:自动; 顶部:4000px; 底部:1000px;; 左:0; } .顶{ 位置:绝对位置; 左:0;右:0; } .左{ 背景图片:url(“文件:/C:/Users/cody/Desktop/Website/Images/Background3.jpg”); 位置:绝对位置; 左:0;顶部:300px;底部:0; 宽度:300px;高度:自动; } 梅因先生{ 位置:绝对位置; 左侧:300px;顶部:300px;右侧:0;底部:0; } .左{ } 梅因先生{ 背景:url(“文件:/C:/Users/cody/Desktop/Website/Images/background.jpg”); } 第1节渐变按钮{ 颜色:#fff; 文本阴影:-2PX2PX#0d4f99; 背景色:#005fb3; 背景图像:线性渐变(顶部,#0d5799,#0d4f99); 盒影:插入0 1px#13457d; 边界:无; 边界半径:8px; } section.gradient按钮:悬停,section.gradient按钮.hover{ 盒影:插入0 1px 13457d,0 5px 15px 152739; } section.gradient按钮:激活,section.gradient按钮.active{ 盒影:插图0 0 1px#13457d,插图0 5px 30px#152739; } 钮扣{ 显示:内联块; 保证金:1px 1px 1px 1px; 填充物:5px 5px 5px 6px; 字体大小:25px; 字体系列:“苦”,衬线; 线高:0.8; 外观:无; 盒影:无; 边界半径:0; 高度:1.2米; 宽度:100%; } 按钮:焦点{ 大纲:无 } p、 桑塞里夫{ 填充底部:30px; 字体系列:Arial、Helvetica、无衬线字体; 字体大小:250%; 颜色:黑色; }

另外,我知道我可以设置一个高度,但我更希望在添加对象时动态更改它。

对于背景图像重复来说,重要的是确保具有背景图像css属性的
div
大于背景图像本身的大小。你检查过这是不是真的吗


如果您的背景图像url是一个非常大的文件(像素大于您的div大小),那么您可以尝试将background size属性设置为小于该div的大小。根据提供的代码,我无法确定您的图像文件的大小,但可以试试吗?希望有帮助。

我从未见过这种HTML结构!!您的
body
位于
div
内!!
<div class="top">
    <body style="text-align: center; ">
    </body>
</div>
<div class="left">
    <p> Links </p>
    <section class="gradient">
        <button>sdf</button>
        <button>sdf</button>
        <button>sdf</button>
        <button>sdf</button>
        <button>sdf</button>
    </section>
sdfsdfs
<img src="file://../Images/Background.jpg" alt="Smiley face" height="42" width="42">
</div>
<div class="main">
    <style>
        img{
            position: absolute;
            margin: auto;
            top: 4000px;
            bottom: 1000px;;
            left: 0;
        }
        .top {
            position: absolute;
            left:0; right:0;
        }
        .left {
            background-image: url("file:/C:/Users/cody/Desktop/Website/Images/Background3.jpg");    
            position:absolute;
            left: 0; top: 300px; bottom: 0;
            width: 300px; height: auto;
        }
        .main {
            position: absolute;
            left:300px; top:300px; right:0; bottom:0;
        }
        .left {    
        }
        .main {
            background:    url("file:/C:/Users/cody/Desktop/Website/Images/Background.jpg");
        }
        section.gradient button {
            color: #fff;
            text-shadow: -2px 2px #0d4f99;
            background-color: #005fb3;
            background-image: linear-gradient(top, #0d5799, #0d4f99);
            box-shadow: inset 0 0 0 1px #13457d;
            border: none;
            border-radius: 8px;
        }
        section.gradient button:hover, section.gradient button.hover {
            box-shadow: inset 0 0 0 1px #13457d,0 5px 15px #152739;
        }

        section.gradient button:active, section.gradient button.active {
            box-shadow: inset 0 0 0 1px #13457d,inset 0 5px 30px #152739;
        }
        button {
            display: inline-block;
            margin: 1px 1px 1px 1px;
            padding: 5px 5px  5px 6px;
            font-size: 25px;
            font-family: "Bitter",serif;
            line-height: 0.8;
            appearance: none;
            box-shadow: none;
            border-radius: 0;
            height : 1.2em;
            width: 100%;
        }
        button:focus {
            outline: none
        }
        p.sansserif {
            padding-bottom: 30px;
            font-family: Arial, Helvetica, sans-serif;
            font-size: 250%;
            color: black;
        }
    </style>
</div>