码迷,mamicode.com
首页 > Web开发 > 详细

css实现图片裁切效果

时间:2014-12-03 14:06:01      阅读:335      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   os   sp   on   div   bs   ad   

 

原始图片:

 

bubuko.com,布布扣

 

效果如图:

 

bubuko.com,布布扣

css:

    .box {
        width: 150px;
        padding: 3px;
        border: 1px solid #e5e5e5;
    }

    .img {
        width: 150px;
        height: 200px;
        position: relative;
        background: red;
        overflow: hidden;
    }

    .img img {
        width: 200px;
        height: 200px;
        top: 0;
        left: 50%;
        margin-left: -100px;
        position: absolute;
    }

    .content {
        font: 12px/24px Arial,"微软雅黑";
    }

html:

    <div class="box">
        <div class="img">
            <img src="1.jpg">
        </div>
        <div class="content">
            这里是内容。
        </div>
    </div>

 

css实现图片裁切效果

标签:http   io   ar   os   sp   on   div   bs   ad   

原文地址:http://www.cnblogs.com/k13web/p/4139871.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!