背景图像与文本

问题描述 投票:0回答:2

我的目标是得到这样的结果:enter image description here

现在,我希望文本在背景图像中。我想我的问题可能在我的块HTML中?

这是一个概述enter image description here

.background_grey {
  height: 70px;
  width: 100%;
  margin-top: 0px;
  position: relative;
}

.page_title {
  font-size: 14px;
}
<img class="background_grey" src="images/subtle_grunge.png" />
<div class="page_title">Register <span class="hometxtcolor">an Account</span></div>

谢谢您的帮助 !

html css css3
2个回答
1
投票

你必须通过CSS使用背景图像,而不是img元素:

.page_title {
  background-image: url(images/subtle_grunge.png);
}
<div class="page_title">
  Register
  <span class="hometxtcolor">
          an Account
        </span>
</div>

-2
投票
© www.soinside.com 2019 - 2024. All rights reserved.