简体   繁体   English

在图片css内容下添加文字

[英]Add a text under the picture css content

I added an image inside the Content.我在内容中添加了一张图片。 I want to add a text under this picture.我想在这张图片下添加文字。 How can I do it?我该怎么做?

 .labelopt:hover:before { display:block; }.tooltip12:before { content: 'Only 75€'; background-image: url(https://i.ytimg.com/vi/Ue1eHtvWRTU/maxresdefault.jpg); background-size: contain;important: height; 150px:important; width: 150px;important: position;absolute: top;50%: transform;translateY(-50%): left;100%: display;none: z-index; 3: border; 2px solid #00cbb1: color; red: text-align; center: padding;5px. font-size:25px; }:labelopt { position; relative; max-width: 176px !important; }
 <br><br><br><br> <div class="clearfix product-variants-item col-xs-6"> <span class="control-label labelopt tooltip12">Add Extra €75</span> <select class="form-control form-control-select" id="group_12" > <option value="48" title="No" selected="selected">No</option> <option value="49" title="Yes">Yes</option> </select> </div>

I tried to do it in the example above, but it comes to the top of the picture.我试图在上面的例子中做到这一点,但它来到了图片的顶部。 I could not assign a background color either.我也无法指定背景颜色。 How can I move it under the picture and set the background color?如何将其移动到图片下方并设置背景颜色?

So here you go, as you have asked to align the text Only 75€ to bottom.所以在这里你 go,因为你要求将文本Only 75€对齐到底部。 And also to change it's background.还要改变它的背景。

CSS CSS

.tooltipspan {

  background-image: url(https://i.ytimg.com/vi/Ue1eHtvWRTU/maxresdefault.jpg);
  background-size: contain !important;
  height: 150px !important;
  width: 150px !important;
  position:absolute;
  top:-70px;
  left:100%;
  transform:translateX(30%);
  display:none;
  z-index: 3;
  line-height:250px;
  border: 2px solid #00cbb1;
  color: red;
  text-align: center;
  padding:5px;
  font-size:25px;
}
.labelopt:hover  .tooltipspan  {
  display:block;
}
.tooltipspan:after {
content:'Only 75€';
background: black;
height:30px;
color:white;
z-index:99999;
}
.labelopt {

    position: relative;
    max-width: 176px !important;
}
.clearfix{
position:relative;
}

HTML HTML

<br><br><br><br>
<div class="clearfix product-variants-item col-xs-6">
      <span class="control-label labelopt tooltip12">Add Extra €75      <span class="tooltipspan" ></span></span>

              <select class="form-control form-control-select" id="group_12" >
                      <option value="48" title="No" selected="selected">No</option>
                      <option value="49" title="Yes">Yes</option>
                  </select>
          </div>

在此处输入图像描述

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

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