float浮动实现图文混排
实例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>float浮动实现图文混排</title> </head> <style> *{ margin: 0; padding: 0; } .fl{ float: left; } .container{ width: 1200px; margin: 0 auto; } .row{ width: 100%; background: #efefef; display: block; padding: 30px; } .container .left,.container .right{ width:48%; max-width: 50%; } .container .left img{ width: 100%; } .container .right{ padding-left: 4%; } .container .right h2 { font-size: 25px; letter-spacing: 0; color: #333; line-height: 50px; margin: 10px 0 30px; } .container .right p { font-size:18px; letter-spacing: 0; color: #333; line-height:36px; margin: 10px 0 30px; } .container a { font-size: 17px; font-weight: 600; color: #444; border: 2px solid #444; padding: 10px 25px; display: inline-block; text-decoration: none; } .container a:hover{ color: #fff; background-color: #333; } </style> <body> <div class="container"> <div class="row fl"> <div class="left fl"><img src="https://img.php.cn/upload/article/000/000/003/5b596217c2850304.jpg" ></div> <div class="right fl"> <h2>PHP程序员从布衣到大牛的必经之路,定制专属于您的私人学习路径</h2> <p>本期课程主要针对零基础学员,只要您会基本的电脑操作和浏览器使用常识 ,就可以报名,兴趣永远是第一位的,当然,如果你有一点基础会更好.要相信自己</p> <a href="">在线报名</a> </div> </div> </div> </body> </html>
运行实例 »
点击 "运行实例" 按钮查看在线实例