css - 包含覆盖文本到图像以供移动 View

标签 css wordpress

我试图让文字包含在图片中。我让它在台式机和平板电脑上完美运行,但我在移动设备上遇到了困难。我让它比以前稍微好一点,但想不出我忽略了什么。

  /* Container holding the image and the text */
   .container {
   position: relative;
   }

  /* Bottom right text */
  .text-block {
    position: absolute;
    display: block;
  bottom: 0;
  right: 0;
  left: 0;
  color: white;
    padding: 0px 40px 0;
    opacity: 0.;
    } 

这是它的外观图片: enter image description here

平板电脑:enter image description here

桌面:enter image description here

<div class="container">
  <img src="uploads/2018/09/App-Design.jpg" alt="App Design">
  <div class="text-block">
    <h6>App Design and Development </h6>
       <p>We design and develop iPhone and Android apps for startups  and   enterprises that are fully compatible with your daily operational activities.</p>
  </div>
</div>

最佳答案

澄清一下,您想让每个部分的文本位于各自的图像内,而不让任何文本位于其图像外?

如果是这样,使用 overflow: hidden; 隐藏所有不适合图像的内容。

如果我误解了你的问题,我很抱歉,你能进一步解释一下吗?

希望这对您有所帮助!

关于css - 包含覆盖文本到图像以供移动 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52378149/

相关文章:

html - 如何在 HTML/CSS 中将文本定位到某物的左侧?

html - CSS 媒体查询在 200px 之后调用?

php - 用于 wordpress 或 Drupal 的吉他指法谱和乐谱导向插件

wordpress - .htaccess 子域语言

Wordpress Woocommerce - REST API 限制最多 100 个对象

javascript - CSS 和 JS - 单击背景时删除模式

html - 1 个内容栏和 2 个侧边栏的 CSS 代码

php - 当 SQL 语法正确时,Wordpress dbDelta 函数不添加表

html - 使用 wkhtmltopdf Node 模块转换为 pdf 时,表行被剪切

WordPress add_action 在另一个函数中