纯 CSS 制作逼真的 iphone7

所属分类: 网页制作 / CSS 阅读数: 2020
收藏 0 赞 0 分享

好几天没有更新了,直接上效果吧,哈哈!(我想这个应该大部分都会!哈哈哈!)

 

代码如下:

html:

<div class="container">
    <div class="round"></div>
    <div class="longround"></div>
    <div class="screen">iphone 7plus</div>
     <div class="home"></div>
</div>

css:

<style type="text/css">
        .container {
            width: 300px;
            height: 600px;
            background-color: rgba(0, 0, 0, .6);
            margin: 50px auto;
            border-radius: 30px;
            box-shadow: 0 0 20px rgba(0, 0, 0, .5);
            position: relative;
            z-index: 999;
        }
        .container::before {
            content: "";
            width: 3px;
            height: 50px;
            background: rgba(0, 0, 0, .5);
            position: absolute;
            top: 170px;
            left: 300px;
            border-radius: 0 4px 4px 0;
        }
        .container::after {
            content: "";
            width: 3px;
            height: 100px;
            background: rgba(0, 0, 0, .5);
            position: absolute;
            top: 50px;
            left: 300px;
            border-radius: 0 4px 4px 0;
        }
        .container .round {
            width: 12px;
            height: 12px;
            border: 3px solid #4a4a4a;
            background-color: rgba(0, 0, 0, .6);
            border-radius: 50%;
            position: absolute;
            left: 50%;
            top: 10px;
            margin-left: -7.5px;
        }
        .container .longround {
            position: absolute;
            width: 100px;
            height: 8px;
            border: 3px solid #4a4a4a;
            background-color: rgba(0, 0, 0, .6);
            border-radius: 30px;
            position: absolute;
            left: 50%;
            margin-left: -50px;
            top: 35px;
        }
        .container .screen {
            width: 280px;
            height: 470px;
            background: linear-gradient(to bottom, rgba(255, 255, 255, .2), rgba(255, 255, 255, .8));
            position: absolute;
            top: 60px;
            left: 50%;
            margin-left: -140px;
            color: #fff;
            text-align: center;
            font-weight: bold;
            font-size: 20px;
            line-height: 450px;
            box-shadow: 0 0 10px rgba(0, 0, 0, .6) inset;
        }
        .container .screen::before {
            content: "";
            width: 50px;
            height: 4px;
            background: rgba(0, 0, 0, .5);
            border-radius: 3px 3px 0 0;
            position: absolute;
            top: -63px;
            left: 180px;
        }
        .container .screen::after {
            content: "";
            width: 7px;
            height: 10px;
            background: rgba(0, 0, 0, .5);
            border-radius: 5px 0 0 5px;
            position: absolute;
            top: -10px;
            left: -17px;
        }
        .container .home {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: rgba(0, 0, 0, .6);
            border: 2px solid #4a4a4a;
            position: absolute;
            bottom: 10px;
            left: 50%;
            margin-left: -25px;
            box-shadow: 0 0 2px black inset;
        }
        .container .home::before {
            content: "";
            width: 25px;
            height: 25px;
            background-color: transparent;
            border: 2px solid rgba(255, 255, 255, .5);
            position: absolute;
            left: 10px; 
            top: 10px;
        }
</style>

总结

以上所述是小编给大家介绍的纯 CSS 制作逼真的 iphone7,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

更多精彩内容其他人还在看

css实现的让图片垂直居中的方法

图片的宽度和高度是未知的,没有一个固定的尺寸,在这个前提下要使图片在一个固定了宽度和高度的容器中垂直居中,想想感觉还是挺麻烦的,由于最近的项目可能会用到这个方案,所以把一些常用的方法都收集整理了一下。
收藏 0 赞 0 分享

3个比较有用的网页制作技巧

我们在进行DivCSS布局的时候,非常关注CSS技巧的学习,今天向大家推荐3个所谓的 “顶级”CSS技巧!虽然没有什么新意,但对新手而言却非常重要!
收藏 0 赞 0 分享

让你写出更轻巧、更快并且更不会让你头疼的CSS的方法

为什么我们的CSS变得一团糟——我们真的很容易陷入这样的困惑中。有时这是一开始就马虎编程的结果,有时是由于后期多重的附加代码(hacks)和修改造成的。
收藏 0 赞 0 分享

利用CSS3的checked伪类实现OL的隐藏显示的方法

随着CSS3的发布,国外研究正如火如荼,但在国内还有很多人抱着IE不支持CSS3的想法,始终无动于衷不肯去学习。
收藏 0 赞 0 分享

CSS多浏览器兼容性(IE和Firefox)技巧大全推荐

CSS对浏览器的兼容性有时让人很头疼,或许当你了解当中的技巧跟原理,就会觉得也不是难事,从网上收集了IE7,6与Fireofx的兼容性处理技巧并整理了一下。
收藏 0 赞 0 分享

固定位置显示弹出层(兼容IE6,IE8,FF)

兼容IE6,IE8,FF弹出层固定位置显示,主要是通过css的控制
收藏 0 赞 0 分享

div完美自适应动态上下左右居中

div完美自适应动态上下左右居中,多用于信息提示框效果。
收藏 0 赞 0 分享

display:inline的用法

和 display:inline 对应的是 display:block,block 会让应用了该 CSS 属性的 HTML 标记变成块级别元素,例如 SPAN 是行内显示的,但是你加了 display:block 属性就不一样了
收藏 0 赞 0 分享

css样式实现整个页面背景使用一张图片

最近一直被css背景困扰,因为是仿站,别人网站背景图片无论怎样另存,都是相同文件名,打开一看,整个网站的各个角落背景图片都在一个文件中分布,于是上网搜集资料,发现使用这种方法的网站很多,源自于雅虎最早。
收藏 0 赞 0 分享

关于CSS样式表文件组织形式的整理

以下引用网络上的一篇文章,不知道作者是谁了,总体上概括的不错,但是在实际应用当中还是要根据项目情况来具体实施比较好。
收藏 0 赞 0 分享
查看更多