简体   繁体   English

渐变边框未填充页眉和页脚部分

[英]Gradient border doesn't fill header and footer section

I am having problems inserting a background image and making my header and footer sections have a gradient background. 我在插入背景图像并使我的页眉和页脚节具有渐变背景时遇到问题。 My background image has to repeat. 我的背景图片必须重复。 Does the .gif picture have to be in the same folder as the css? .gif图片是否必须与CSS放在同一文件夹中? This is the css for it. 这是它的CSS。

body {
    background-image: url("folder1/pic.gif");
    background-repeat: repeat-x repeat-y;
}

I am also working on a linear gradient that goes from white to orange to black. 我还在研究从白色到橙色再到黑色的线性渐变。 This gradient would then be the background for the header and footer sections. 然后,此渐变将成为页眉和页脚部分的背景。 I am able to split and provide the header and footer section a linear gradient background but it does not extend all the way to the border of my header and footer. 我可以拆分并为页眉和页脚部分提供线性渐变背景,但它不会一直延伸到页眉和页脚的边界。 This is the html section for the header 这是标题的html部分

<header>
    <div id="eg1">
        <img src="images/pumpkin.gif" alt= "pumpkin" height="78" width="85">
        <h1>The Halloween Store</h1>
        <h3>For the little Goblin in all of us!</h3>
    </div>
</header>

The css formatting the html I have as 格式化我的HTML的CSS

/*gradient header*/
#eg1 {
    background-image: -webkit-linear-gradient(45deg,  white 0%, #ffa500 75%, #000000 100%);
}

As you can see in this example the gradient shows fine and the background image also shows. 如您在本示例中所见,渐变显示得很好,背景图像也显示了。

Be aware : On some browsers the gradient may not appear because of the browser version or the syntax. 请注意 :在某些浏览器中,由于浏览器版本或语法的原因,可能不会显示渐变。

So I used all the prefixes for gradient to be as many brosers as possible are supported: 因此,我使用了梯度的所有前缀来支持尽可能多的brosers:

  background-image: linear-gradient(45deg,  white 0%, #ffa500 75%, #000000 100%);
  background-image: -webkit-linear-gradient(45deg,  white 0%, #ffa500 75%, #000000 100%);
  background-image: -moz-linear-gradient(45deg,  white 0%, #ffa500 75%, #000000 100%);
  background-image: -o-linear-gradient(45deg,  white 0%, #ffa500 75%, #000000 100%);

For more about browser support check this 有关浏览器支持的更多信息,请检查

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

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