网页设计如何使图片和文字对应?

想要做出如图的效果,但是
1.图片在同一行并排后,下面的文字无法一一对应
2尝试了在div里面套div,但是图片无法并列排放

首先页面以列为布局方式,
dl > dt > dd * 3, 左浮动,居中用 text-align : center
温馨提示:答案为网友推荐,仅供参考
第1个回答  2021-06-08

div套div是可以实现的,是你自己属性没有设置好,具体代码如下:

代码效果图

<body>

   <div style="width: 900px; height: 100px; margin: 0 auto;background-color: aqua;">

     这里是店招

   </div>

   <div style="width: 900px; height: 200px; margin: 0 auto; padding-top: 20px;">

     <div style="width: 200px; height: 200px; float: left;background-color:#FF0004;">

   这里是图片

     </div>

     <div style="width: 180px; height: 180px; float: left;background-color:#FF0004; margin-left: 20px; padding: 10px;">

  这里是图片

     </div>

     <div style="width: 180px; height: 180px; float: left;background-color:#FF0004; margin-left: 20px; padding: 10px;">

   这里是图片

     </div>

     <div style="width: 180px; height: 180px; float: left;background-color:#FF0004; margin-left: 20px; padding: 10px;">

   这里是图片

     </div>

   </div>

   <div style="width: 900px; height: 100px; margin: 0 auto; padding-top: 20px;">

     <div style="width: 200px; height: 100px; float: left;background-color:#FF0004;">

   这里是标题其他的自己改

     </div>

     <div style="width: 180px; height: 80px; float: left;background-color:#FF0004; margin-left: 20px; padding: 10px;">

   这里是图片是文字这里是图片是文字这里是图片是文字这里是图片是文字

     </div>

     <div style="width: 180px; height: 80px; float: left;background-color:#FF0004; margin-left: 20px; padding: 10px;">

   这里是图片是文字这里是图片是文字这里是图片是文字这里是图片是文字

     </div>

     <div style="width: 180px; height: 80px; float: left;background-color:#FF0004; margin-left: 20px; padding: 10px;">

   这里是图片是文字这里是图片是文字这里是图片是文字这里是图片是文字

     </div>

   </div>

</body>

相似回答