• html+css 在图片上添加文字


    html  

    <view class="container">
        <image class="" src="{{book.image}}"></image>
        <view class="description">
            <text class="title">{{book.title}}</text>
            <text class="author">{{book.author}}</text>
            <view class='foot'>
                <text class="footer">{{book.fav_nums}}  喜欢</text>
            </view>
        </view>
    </view>

    css 

    /* component/page/index.wxss */
    .container {
       display: flex;
       flex-direction: column;
       align-items: center;
       margin-top: 30rpx;
       box-shadow: 2px  2px  3px #e3e3e3e3;
       position: relative;
        240rpx;
       height: 360rpx;
    }
    .container image{
        100%;
       height: 100%;
       border-radius: 2px;
    }
    .description {
       100%;
      position:absolute; 
      z-index:2;
      left:0;
      bottom:0;
      background-color: white;
    }

    这里我们 使用到 position : absolute;同时设置 bottom:0;left:0;  来生成 绝对定位 因为我们这里   position : absolute 要生效,

    相对于 static 定位以外的第一个父元素进行定位  所以我们 设置父元素为相对定位

  • 相关阅读:
    jdbc在项目中的应用
    第五次作业-springmvc对表单的获取
    jquery的文档处理(部分)
    测试报告怎么写合理
    WebService的简单应用
    hdu--5078--orz
    hdu--5074--dp
    hdu--5108--数论
    hdu--5072--容斥原理
    hdu--3853--概率dp
  • 原文地址:https://www.cnblogs.com/guangzhou11/p/11462557.html
Copyright © 2020-2023  润新知