【发布时间】:2019-01-23 23:07:29
【问题描述】:
我正在尝试制作一个带有 h1 标题的全角英雄图像,里面有 2 种大小的文本以及一个按钮的盒装文本。我整天都在为此苦苦挣扎,但它似乎并没有按照我想要的方式工作。任何帮助将非常感激。
谢谢
图片: How it looks at the moment with code
如果您注意到它没有全宽(左侧的间隙)。
This is how i would like it to look or close enough
//css//
.hero-image {
background-image: url("image.jpg");
background-position: 100%;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
padding: 50px;
}
.hero-text {
position: relative;
color: #154774;
}
.hero-text button {
border-radius: 5px;
padding: 10px 20px;
color: white;
background-color: #00adee;
text-align: center;
cursor: pointer;
font-size: 20px;
font-weight: bold;
bottom: 50px;
}
.hero-text button:hover {
background-color: #0597c4;
color: white;
}
.herotext2 {
border-radius: 5px;
padding: 10px 10px 10px 10px;
color: white;
background-color: red;
font-size: 20px;
width: 200px;
line-height: 1.4;
}
</style>
//html//
<div class="hero-image">
<div class="hero-text">
<h1 style="font-size:40px">IT support for<br>your business<br>as easy as<br>child’s play</h1>
<p class="herotext2">All inclusive IT GDPR service packages from £33 p/m</p>
<button>Try it for free today</button>
</div>
</div>
更新图片: Updated image
【问题讨论】:
标签: html css image responsive