如何在Bootstrap的背景图片中添加文本?

时间:2018-07-04 04:45:36

标签: css twitter-bootstrap background-image

我正在设计Bootstrap表单。我想在背景图片中添加文本,如下所示:http://dubaiexporters.com/member_benefits.aspx。我尝试了下面的代码,但文本不能很好地适合背景图像。

enter image description here

我是Bootstrap的新手。

代码:

<div class="container">
 <div class="silverAds">
                        <div class="adContent">
                            <ul><li><a href="pdf/Dubai_Exporters_Member_Certficate.pdf" target="_blank">DubaiExporters Membership Certificate </a></li> 
                                <li>Log in to access and edit the Company profile. </li>
                                <li>Access to the latest inquiries received from agents, importers, distributors all
                                    over the world.</li>
                                <li>Company’s Logo , profile & the website link in the Supplier’s section.</li>
                                <li>Advertisement of the Company shall be included in the Listing.</li>
                                <li>Weekly Newsletter updates from Dubai Exporters containing latest news about the
                                    world economy, export scenarios, upcoming projects, trade events, market reviews
                                    and the link to the Member’s Profile on Dubai Exporters, shall be mailed to our
                                    entire database of over 150000 Importers from Africa, CIS,Eastern Europe, latin
                                    America, Asia.&nbsp;<a class="lightbox" href="images/newslettertemplate.jpg">View sample</a></li>
                                <li>A CD of Dubai Exporters shall be distributed to all the trade visitors and importers
                                    visiting Int’l trade exhibitions where Dubai Exporters participates, thereby making
                                    your company’s information reach the right target audience. </li>
                            </ul>
                            <div style="float: right; padding:15px 60px 0px 0px;">
                                <asp:ImageButton ID="btSilver" runat="server" ImageUrl="images/mem_btn.png"
                                     /></div>
                        </div>
                    </div>
</div>

CSS:

 .silverAds
{


    background: url(  'images/SILVER-member.jpg' ) no-repeat center 0;
    height: 372px;
    width: 50%;
    margin: 0px 0px 20px 0px;
    width:100%;
}

 .adContent
{
    padding:80px 80px 0px 65px;
    width:87%;
}

div.adContent li
{

    font-family :Arial;
    font-size: 12px;
    list-style-image: none;
    color:#FFFFFF;
    line-height:16px;

}
div.adContent li a{color:#FFFFFF; text-decoration:underline;}

1 个答案:

答案 0 :(得分:0)

使用background-size: 100% 100%;height: 100%;

请参见小提琴:https://jsfiddle.net/5shda4pc/2/

 .silverAds
{
    background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg');
    height: 100%;
    margin: 0px 0px 20px 0px;
    width:100%;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

 .adContent
{
    padding:80px 80px 0px 65px;
    width:87%;
}

div.adContent li
{

    font-family :Arial;
    font-size: 12px;
    list-style-image: none;
    color:#FFFFFF;
    line-height:16px;

}
div.adContent li a{color:#FFFFFF; text-decoration:underline;}
<div class="container">
 <div class="silverAds">
    <div class="adContent">
      <ul><li><a href="pdf/Dubai_Exporters_Member_Certficate.pdf" target="_blank">DubaiExporters Membership Certificate </a></li> 
        <li>Log in to access and edit the Company profile. </li>
        <li>Access to the latest inquiries received from agents, importers, distributors all
                                    over the world.</li>
        <li>Company’s Logo , profile & the website link in the Supplier’s section.</li>
        <li>Advertisement of the Company shall be included in the Listing.</li>
        <li>Weekly Newsletter updates from Dubai Exporters containing latest news about the
                                    world economy, export scenarios, upcoming projects, trade events, market reviews
                                    and the link to the Member’s Profile on Dubai Exporters, shall be mailed to our
                                    entire database of over 150000 Importers from Africa, CIS,Eastern Europe, latin
                                    America, Asia.&nbsp;<a class="lightbox" href="images/newslettertemplate.jpg">View sample</a></li>
         <li>A CD of Dubai Exporters shall be distributed to all the trade visitors and importers
                                    visiting Int’l trade exhibitions where Dubai Exporters participates, thereby making
                                    your company’s information reach the right target audience. </li>
                            </ul>
                            <div style="float: right; padding:15px 60px 0px 0px;">
                                <asp:ImageButton ID="btSilver" runat="server" ImageUrl="images/mem_btn.png"
                                     /></div>
                        </div>
                    </div>
</div>