简体   繁体   English

如何使用内联块属性将文本放置在背景图像下方

[英]how to place text below background image using inline block property

hello i'm trying to put text below a background images. 你好,我正在尝试将文字放在背景图片下方。 like here i want place two background images side by side and below each image i wanna place text. 像在这里,我想并排放置两个背景图像,并且在每个图像下面都想放置文本。 i have take one div class it has styles inline block property. 我有一个div类,它具有样式内联块属性。 so how i can do this with the help of or using inline block property.i have explained my problem as much as i can. 因此,我如何借助或使用内联块属性来做到这一点。我已尽我所能解释了我的问题。 if it is possible then please go through my fiddle link. 如果可能的话,请通过我的小提琴链接。 i have tried by this properties but text is overlaping on the image i want that below the image also check similar questions no one has done with background image so please check out my code what i have tried it is given in the comment box. 我已经尝试过使用此属性,但是图像上的文本重叠,我希望图像下方也可以检查类似的问题,没有人对背景图像进行过检查,因此请查看我的代码,我在注释框中给出了我所尝试的内容。 please help me thanks. 请帮我谢谢。 :) :)

I hope this was what you where looking for. 我希望这是您要寻找的东西。

Here is a link to an updated fiddle: Fiddle 这是更新的小提琴的链接: 小提琴

If you change te background-color to an image, it should still work 如果您将背景色更改为图像,则该图像仍应工作

I simply added: 我只是添加:

.imgcontainer p {
  position: relative;
  bottom: -90px;
  max-width: 100px;
}

To the paragraph 到本段

You haven't set a css property for your paragraph tag within your imgcontainer. 您尚未在imgcontainer中为段落标记设置css属性。

In my fiddle, I added the following : 在我的小提琴中,我添加了以下内容:

.imgcontainer p {
  position: relative;
  top: 100px;
}

I also added a background-size to both of the background images. 我还为两个背景图像都添加了background-size I used background-size: cover; 我用background-size: cover; (I replaced the image urls with ones that I have in my image folder on my website) (我将图片网址替换为网站上图片文件夹中的网址)

https://jsfiddle.net/RachGal/f0fsLd2h/ :Fiddle https://jsfiddle.net/RachGal/f0fsLd2h/ :小提琴

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

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