删除html页面右侧的额外滚动空间

时间:2016-09-19 12:16:27

标签: javascript html css

我有一个标题标签,如

h1 {
    background: url('../welcome_page/resources/images/welcome-logo.jpg') 0 0 no-repeat;
    color: white;
    position: absolute;
    top: 0px;
    margin: auto;
    z-index: 100000;
    padding-top: 30px;
    height: 80px;
    background-color: #4775A3;
    border-bottom-style: solid;
    border-bottom-color: black;
}

在我的html页面中。这在右侧创造了额外的空间。任何人都可以建议删除右侧的额外空间吗?

2 个答案:

答案 0 :(得分:0)

body { margin: 0; padding: 0 }

h1 {
    background: url('../welcome_page/resources/images/welcome-logo.jpg') 0 0 no-repeat;
    color: white;
    position: absolute;
    top: 0px;
    margin: auto;
    z-index: 100000;
    padding-top: 30px;
    height: 80px;
    background-color: #4775A3;
    border-bottom-style: solid;
    border-bottom-color: black;
}
<h1>Hello World</h1>

标题

答案 1 :(得分:0)

HTML

< h1>< text>XXX  </text ></h1 >

CSS

h1 {
background: url('../icons/welcome-logo.jpg') 0 0 no-repeat;
color:white;
position: absolute;
top: 0px;
margin: auto;
z-index: 100000;
width: 100%;
padding-top: 30px;
text-align: left;
height: 80px;
background-color: #4775A3;
border-bottom-style: solid;
border-bottom-color: black;
}

text{
    padding-left: 150px;
}