繁体   English   中英

如何使文字覆盖在图像上?

[英]How can I get text to overlay over an image?

我似乎无法使文字显示为覆盖在图像上。 我已经在Codepen中测试了代码片段,并可以在此处获得所需的效果。

HTML:

   <div class="container-fluid">
    <div class="row">
        <div class="banner">
            <img src="https://imageshack.com/a/img923/9364/qvCJa4.png" pagespeed_url_hash="616443323" onload="pagespeed.CriticalImages.checkImageForCriticality(this);" />

            <div class="container-fluid purchaceNowOverlayText">
                <div class="row">
                    <div class=" col-sm-1">
                        <hr>
                    </div>
                    <div class="col-sm-11">
                        <h2>Are you Ready? <b>Purchace Here!</b></h2>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-12 col-md-6 col-lg-6 headerRow">
                        <img src="images/3bottlesdone.png" width="400px" height="300px">
                    </div>
                    <div class="col-sm-12 col-md-6 col-lg-6 headerRow">
                        <p>This text should overlay over the bg image This text should overlay over the bg image This text should overlay over the bg image This text should overlay over the bg image This text should overlay over the bg image This text should overlay over the bg image This text should overlay over the bg image This text should overlay over the bg image This text should overlay over the bg image </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

CSS:

.banner{ position:relative; width:90%; margin:0 auto; }  
.banner img{width:100%;}
.purchaceNowOverlayext{position:absolute; top:50%; color: white;}

错字。 您的CSS类在purchaceNowOverlay T ext上缺少T

暂无
暂无

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

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