欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

基于CSS3画一个iPhone

程序员文章站 2022-06-27 07:52:14
实现效果:实现代码html

实现代码

html

<div class='iphone'>
  <div class='steel_band'>
    <div class='mute_rocker'></div>
    <div class='volume up'></div>
    <div class='volume down'></div>
    <div class='sleep_wake'></div>
    <div class='plastic_band'>
      <div class='glass_face'>
        <div class='camera'></div>
        <div class='speaker'></div>
        <div class='home_button'></div>
        <div class='gloss'></div>
        <div class='screen'>
          <div class='stage'></div>
        </div>
      </div>
    </div>
  </div>
</div>

css3

html, body {
  height: 100%;
}

body {
  text-align: center;
  padding: 50px;
  background: #ccc;
}

.iphone {
  display: inline-block;
  vertical-align: middle;
  *vertical-align: auto;
  *zoom: 1;
  *display: inline;
}

.iphone {
  position: relative;
}
.iphone .steel_band {
  position: relative;
  width: 372px;
  height: 734px;
  padding: 3px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaumcigete9ijaunsigedi9ijeumcigeti9ijaunsi+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0ii2rjzgjkysivpjxzdg9wig9mznnldd0imtawjsigc3rvcc1jb2xvcj0ii2vizwflosivpjwvbgluzwfyr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia==');
  background: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #dcdbda), color-stop(100%, #ebeae9));
  background: -moz-linear-gradient(left, #dcdbda, #ebeae9);
  background: -webkit-linear-gradient(left, #dcdbda, #ebeae9);
  background: linear-gradient(to right, #dcdbda, #ebeae9);
  -moz-border-radius: 60px;
  -webkit-border-radius: 60px;
  border-radius: 60px;
  -moz-box-shadow: inset 1px 0 0 #7e7c7a, inset -1px 0 1px #7e7c7a;
  -webkit-box-shadow: inset 1px 0 0 #7e7c7a, inset -1px 0 1px #7e7c7a;
  box-shadow: inset 1px 0 0 #7e7c7a, inset -1px 0 1px #7e7c7a;
}
.iphone .plastic_band {
  width: 364px;
  height: 726px;
  padding: 4px;
  -moz-border-radius: 57px;
  -webkit-border-radius: 57px;
  border-radius: 57px;
  background: #2b2b2b;
  -moz-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 0, 0, 0.5);
  -webkit-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.5), 0 0 1px rgba(0, 0, 0, 0.5);
}
.iphone .glass_face {
  position: relative;
  width: 364px;
  height: 726px;
  overflow: hidden;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaunsigete9ijaumcigedi9ijaunsigeti9ijeumci+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0iizawmdawmcivpjxzdg9wig9mznnldd0imtawjsigc3rvcc1jb2xvcj0iiza5mdkwosivpjwvbgluzwfyr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia==');
  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #000000), color-stop(100%, #090909));
  background: -moz-linear-gradient(#000000, #090909);
  background: -webkit-linear-gradient(#000000, #090909);
  background: linear-gradient(#000000, #090909);
  -moz-border-radius: 53px;
  -webkit-border-radius: 53px;
  border-radius: 53px;
  -moz-box-shadow: -1px -1px 2px rgba(255, 255, 255, 0.15), -1px -1px 0 rgba(0, 0, 0, 0.5);
  -webkit-box-shadow: -1px -1px 2px rgba(255, 255, 255, 0.15), -1px -1px 0 rgba(0, 0, 0, 0.5);
  box-shadow: -1px -1px 2px rgba(255, 255, 255, 0.15), -1px -1px 0 rgba(0, 0, 0, 0.5);
}
.iphone .gloss {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 100%;
  -webkit-mask-image: linear-gradient(-105deg, #000000 32%, rgba(0, 0, 0, 0) 32%);
  -moz-border-radius: 53px;
  -webkit-border-radius: 53px;
  border-radius: 53px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijeumdcwndi4iib5mt0imc42mda1odiiihgypsitmc4wnza0mjgiihkypsiwljm5otqxoci+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0ii2zmzmzmziigc3rvcc1vcgfjaxr5psiwljyilz48c3rvccbvzmzzzxq9ijcwjsigc3rvcc1jb2xvcj0ii2zmzmzmziigc3rvcc1vcgfjaxr5psiwljailz48l2xpbmvhckdyywrpzw50pjwvzgvmcz48cmvjdcb4psiwiib5psiwiib3awr0ad0imtawjsigagvpz2h0psixmdaliibmawxspsj1cmwoi2dyywqpiiavpjwvc3znpia=') no-repeat;
  background: -moz-linear-gradient(170deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 70%) no-repeat;
  background: -webkit-linear-gradient(170deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 70%) no-repeat;
  background: linear-gradient(280deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 70%) no-repeat;
  -moz-background-size: 60% 100%;
  -o-background-size: 60% 100%;
  -webkit-background-size: 60% 100%;
  background-size: 60% 100%;
  background-position: top right;
}
.iphone .camera {
  position: absolute;
  z-index: 2;
  top: 50px;
  left: 50%;
  margin-left: -75px;
  height: 8px;
  width: 8px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  -moz-border-radius: 9px;
  -webkit-border-radius: 9px;
  border-radius: 9px;
  -moz-box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.25);
  -webkit-box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.25);
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+phjhzglhbedyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsj1c2vyu3bhy2vpblvzzsigy3g9ijvwecigy3k9ijvwecigcj0imtawjsi+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0iizfimwixyiivpjxzdg9wig9mznnldd0imtawjsigc3rvcc1jb2xvcj0iizm0mzqzncivpjwvcmfkawfsr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia==');
  background: -moz-radial-gradient(5px 5px, #1b1b1b, #343434);
  background: -webkit-radial-gradient(5px 5px, #1b1b1b, #343434);
  background: radial-gradient(5px 5px, #1b1b1b, #343434);
  background-position: top left;
}
.iphone .camera:after {
  display: block;
  height: 8px;
  width: 8px;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  border-radius: 4px;
  -moz-box-shadow: 1px 1px 1px rgba(255, 255, 255, 0.1);
  -webkit-box-shadow: 1px 1px 1px rgba(255, 255, 255, 0.1);
  box-shadow: 1px 1px 1px rgba(255, 255, 255, 0.1);
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+phjhzglhbedyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsj1c2vyu3bhy2vpblvzzsigy3g9ijfwecigy3k9ijfwecigcj0intalij48c3rvccbvzmzzzxq9iji1jsigc3rvcc1jb2xvcj0iiznjmmi5mcivpjxzdg9wig9mznnldd0intaliibzdg9wlwnvbg9ypsijm2myyjkwiibzdg9wlw9wywnpdhk9ijaunzuilz48l3jhzglhbedyywrpzw50pjwvzgvmcz48cmvjdcb4psiwiib5psiwiib3awr0ad0imtawjsigagvpz2h0psixmdaliibmawxspsj1cmwoi2dyywqpiiavpjwvc3znpia='), url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+phjhzglhbedyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsj1c2vyu3bhy2vpblvzzsigy3g9ijfwecigy3k9ijfwecigcj0intalij48c3rvccbvzmzzzxq9iji1jsigc3rvcc1jb2xvcj0iizjinwq5mcigc3rvcc1vcgfjaxr5psiwljc1ii8+phn0b3agb2zmc2v0psi1mcuiihn0b3aty29sb3i9iimyyjvkotaiihn0b3atb3bhy2l0et0imc4wii8+pc9yywrpywxhcmfkawvudd48l2rlznm+phjly3qged0imciget0imcigd2lkdgg9ijewmcuiighlawdodd0imtawjsigzmlsbd0idxjskcnncmfkksiglz48l3n2zz4g'), url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+phjhzglhbedyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsj1c2vyu3bhy2vpblvzzsigy3g9ijfwecigy3k9ijfwecigcj0intalij48c3rvccbvzmzzzxq9iji1jsigc3rvcc1jb2xvcj0iizjinwq5mcigc3rvcc1vcgfjaxr5psiwljc1ii8+phn0b3agb2zmc2v0psi1mcuiihn0b3aty29sb3i9iimyyjvkotaiihn0b3atb3bhy2l0et0imc4wii8+pc9yywrpywxhcmfkawvudd48l2rlznm+phjly3qged0imciget0imcigd2lkdgg9ijewmcuiighlawdodd0imtawjsigzmlsbd0idxjskcnncmfkksiglz48l3n2zz4g'), url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+phjhzglhbedyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsj1c2vyu3bhy2vpblvzzsigy3g9ijuwjsigy3k9ijuwjsigcj0injalij48c3rvccbvzmzzzxq9ijqwjsigc3rvcc1jb2xvcj0iiza3mtmxyiivpjxzdg9wig9mznnldd0injaliibzdg9wlwnvbg9ypsijmwizzdcwii8+pc9yywrpywxhcmfkawvudd48l2rlznm+phjly3qged0imciget0imcigd2lkdgg9ijewmcuiighlawdodd0imtawjsigzmlsbd0idxjskcnncmfkksiglz48l3n2zz4g');
  background: -moz-radial-gradient(1px 1px, #3c2b90 25%, rgba(60, 43, 144, 0.75) 50%), -moz-radial-gradient(1px 1px, rgba(43, 93, 144, 0.75) 25%, rgba(43, 93, 144, 0) 50%), -moz-radial-gradient(1px 1px, rgba(43, 93, 144, 0.75) 25%, rgba(43, 93, 144, 0) 50%), -moz-radial-gradient(#07131b 40%, #1b3d70 60%);
  background: -webkit-radial-gradient(1px 1px, #3c2b90 25%, rgba(60, 43, 144, 0.75) 50%), -webkit-radial-gradient(1px 1px, rgba(43, 93, 144, 0.75) 25%, rgba(43, 93, 144, 0) 50%), -webkit-radial-gradient(1px 1px, rgba(43, 93, 144, 0.75) 25%, rgba(43, 93, 144, 0) 50%), -webkit-radial-gradient(#07131b 40%, #1b3d70 60%);
  background: radial-gradient(1px 1px, #3c2b90 25%, rgba(60, 43, 144, 0.75) 50%), radial-gradient(1px 1px, rgba(43, 93, 144, 0.75) 25%, rgba(43, 93, 144, 0) 50%), radial-gradient(1px 1px, rgba(43, 93, 144, 0.75) 25%, rgba(43, 93, 144, 0) 50%), radial-gradient(#07131b 40%, #1b3d70 60%);
  background-position: top left, center left, center, right center;
  content: "";
}
.iphone .speaker {
  position: absolute;
  z-index: 2;
  top: 50px;
  left: 50%;
  margin-left: -37px;
  width: 62px;
  height: 8px;
  padding: 5px;
  -moz-border-radius: 9px;
  -webkit-border-radius: 9px;
  border-radius: 9px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+phjhzglhbedyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsj1c2vyu3bhy2vpblvzzsigy3g9ijuwjsigy3k9ijuwjsigcj0imtawjsi+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0ii2zmzmzmziigc3rvcc1vcgfjaxr5psiwljm1ii8+phn0b3agb2zmc2v0psixmdaliibzdg9wlwnvbg9ypsijzmzmzmzmiibzdg9wlw9wywnpdhk9ijaumcivpjwvcmfkawfsr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia==') no-repeat, url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaunsigete9ijaumcigedi9ijaunsigeti9ijeumci+phn0b3agb2zmc2v0psi0nc40ndq0ncuiihn0b3aty29sb3i9iimwmdawmdailz48c3rvccbvzmzzzxq9ijewmcuiihn0b3aty29sb3i9iim0ndq0ndqilz48l2xpbmvhckdyywrpzw50pjwvzgvmcz48cmvjdcb4psiwiib5psiwiib3awr0ad0imtawjsigagvpz2h0psixmdaliibmawxspsj1cmwoi2dyywqpiiavpjwvc3znpia=');
  background: radial-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)) no-repeat, -webkit-gradient(linear, 50% 0%, 50% 18, color-stop(44.44444%, #000000), color-stop(100%, #444444));
  background: -moz-radial-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)) no-repeat, -moz-linear-gradient(#000000 8px, #444444 18px);
  background: -webkit-radial-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)) no-repeat, -webkit-linear-gradient(#000000 8px, #444444 18px);
  background: radial-gradient(rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0)) no-repeat, linear-gradient(#000000 8px, #444444 18px);
  -moz-background-size: 10px 10px, 100% 100%;
  -o-background-size: 10px 10px, 100% 100%;
  -webkit-background-size: 10px 10px, 100% 100%;
  background-size: 10px 10px, 100% 100%;
  background-position: bottom right, center;
}
.iphone .speaker:after {
  display: block;
  width: 62px;
  height: 8px;
  -moz-border-radius: 6px;
  -webkit-border-radius: 6px;
  border-radius: 6px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaumcigete9ijeumcigedi9ijeumcigeti9ijaumci+phn0b3agb2zmc2v0psiynsuiihn0b3aty29sb3i9iimwmdawmdailz48c3rvccbvzmzzzxq9iji1jsigc3rvcc1jb2xvcj0iizawmdawmcigc3rvcc1vcgfjaxr5psiwljailz48c3rvccbvzmzzzxq9ijc1jsigc3rvcc1jb2xvcj0iizawmdawmcigc3rvcc1vcgfjaxr5psiwljailz48c3rvccbvzmzzzxq9ijc1jsigc3rvcc1jb2xvcj0iizawmdawmcivpjxzdg9wig9mznnldd0imtawjsigc3rvcc1jb2xvcj0iizawmdawmcivpjwvbgluzwfyr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia=='), #888;
  background: -moz-linear-gradient(45deg, #000000 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 75%, #000000 75%, #000000), #888;
  background: -webkit-linear-gradient(45deg, #000000 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 75%, #000000 75%, #000000), #888;
  background: linear-gradient(45deg, #000000 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 75%, #000000 75%, #000000), #888;
  -moz-background-size: 2px 2px;
  -o-background-size: 2px 2px;
  -webkit-background-size: 2px 2px;
  background-size: 2px 2px;
  -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.75), inset 0 0 2px rgba(0, 0, 0, 0.5);
  -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.75), inset 0 0 2px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.75), inset 0 0 2px rgba(0, 0, 0, 0.5);
  content: "";
}
.iphone .home_button {
  position: absolute;
  bottom: 20px;
  left: 50%;
  margin-left: -35px;
  height: 70px;
  width: 70px;
  -moz-border-radius: 35px;
  -webkit-border-radius: 35px;
  border-radius: 35px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaumcigete9ijaunsigedi9ijeumcigeti9ijaunsi+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0iizq0ndq0ncivpjxzdg9wig9mznnldd0injaliibzdg9wlwnvbg9ypsijmdawmdawii8+pc9saw5lyxjhcmfkawvudd48l2rlznm+phjly3qged0imciget0imcigd2lkdgg9ijewmcuiighlawdodd0imtawjsigzmlsbd0idxjskcnncmfkksiglz48l3n2zz4g');
  background: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #444444), color-stop(60%, #000000));
  background: -moz-linear-gradient(left, #444444, #000000 60%);
  background: -webkit-linear-gradient(left, #444444, #000000 60%);
  background: linear-gradient(to right, #444444, #000000 60%);
  border: 1px solid #000;
  -moz-box-shadow: 1px 1px 1px #222, inset 0 10px 30px rgba(0, 0, 0, 0.5);
  -webkit-box-shadow: 1px 1px 1px #222, inset 0 10px 30px rgba(0, 0, 0, 0.5);
  box-shadow: 1px 1px 1px #222, inset 0 10px 30px rgba(0, 0, 0, 0.5);
}
.iphone .home_button:after {
  position: absolute;
  top: 23px;
  left: 23px;
  right: 23px;
  bottom: 23px;
  border: 2px solid #888;
  -moz-box-shadow: inset 0 0 1px #000, 0 0 1px #000;
  -webkit-box-shadow: inset 0 0 1px #000, 0 0 1px #000;
  box-shadow: inset 0 0 1px #000, 0 0 1px #000;
  -moz-border-radius: 6px;
  -webkit-border-radius: 6px;
  border-radius: 6px;
  content: "";
}
.iphone .screen {
  position: absolute;
  top: 120px;
  left: 50%;
  margin-left: -166px;
  width: 320px;
  height: 480px;
  padding: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  background: #0a0a0a;
}
.iphone .stage {
  width: 320px;
  height: 480px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaunsigete9ijaumcigedi9ijaunsigeti9ijeumci+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0iiziymjiymiivpjxzdg9wig9mznnldd0imtawjsigc3rvcc1jb2xvcj0iizexmtexmsivpjwvbgluzwfyr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia==');
  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #222222), color-stop(100%, #111111));
  background: -moz-linear-gradient(#222222, #111111);
  background: -webkit-linear-gradient(#222222, #111111);
  background: linear-gradient(#222222, #111111);
}
.iphone .mute_rocker {
  position: absolute;
  top: 90px;
  right: 100%;
  width: 2px;
  height: 32px;
  border: 1px solid #888;
  border-right: none;
  -moz-border-radius-topleft: 2px;
  -webkit-border-top-left-radius: 2px;
  border-top-left-radius: 2px;
  -moz-border-radius-bottomleft: 2px;
  -webkit-border-bottom-left-radius: 2px;
  border-bottom-left-radius: 2px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaunsigete9ijaumcigedi9ijaunsigeti9ijeumci+phn0b3agb2zmc2v0psi1jsigc3rvcc1jb2xvcj0ii2zizmjmyiivpjxzdg9wig9mznnldd0insuiihn0b3aty29sb3i9iinkymrizgiilz48c3rvccbvzmzzzxq9ijuwjsigc3rvcc1jb2xvcj0ii2rizgjkyiivpjxzdg9wig9mznnldd0inzuliibzdg9wlwnvbg9ypsijywvhzwflii8+phn0b3agb2zmc2v0psi5mcuiihn0b3aty29sb3i9iinmymzizmiilz48l2xpbmvhckdyywrpzw50pjwvzgvmcz48cmvjdcb4psiwiib5psiwiib3awr0ad0imtawjsigagvpz2h0psixmdaliibmawxspsj1cmwoi2dyywqpiiavpjwvc3znpia=');
  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(5%, #fbfbfb), color-stop(5%, #dbdbdb), color-stop(50%, #dbdbdb), color-stop(75%, #aeaeae), color-stop(90%, #fbfbfb));
  background: -moz-linear-gradient(#fbfbfb 5%, #dbdbdb 5%, #dbdbdb 50%, #aeaeae 75%, #fbfbfb 90%);
  background: -webkit-linear-gradient(#fbfbfb 5%, #dbdbdb 5%, #dbdbdb 50%, #aeaeae 75%, #fbfbfb 90%);
  background: linear-gradient(#fbfbfb 5%, #dbdbdb 5%, #dbdbdb 50%, #aeaeae 75%, #fbfbfb 90%);
}
.iphone .volume {
  position: absolute;
  right: 100%;
  width: 2px;
  height: 25px;
  border: 1px solid #888;
  border-right: none;
  -moz-border-radius-topleft: 2px;
  -webkit-border-top-left-radius: 2px;
  border-top-left-radius: 2px;
  -moz-border-radius-bottomleft: 2px;
  -webkit-border-bottom-left-radius: 2px;
  border-bottom-left-radius: 2px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaunsigete9ijaumcigedi9ijaunsigeti9ijeumci+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0ii2rizgjkyiivpjxzdg9wig9mznnldd0imtuliibzdg9wlwnvbg9ypsijzwvlzwvlii8+phn0b3agb2zmc2v0psi3nsuiihn0b3aty29sb3i9iimzmzmzmzmilz48c3rvccbvzmzzzxq9ijkwjsigc3rvcc1jb2xvcj0ii2zizmjmyiivpjwvbgluzwfyr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia==');
  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dbdbdb), color-stop(15%, #eeeeee), color-stop(75%, #333333), color-stop(90%, #fbfbfb));
  background: -moz-linear-gradient(#dbdbdb, #eeeeee 15%, #333333 75%, #fbfbfb 90%);
  background: -webkit-linear-gradient(#dbdbdb, #eeeeee 15%, #333333 75%, #fbfbfb 90%);
  background: linear-gradient(#dbdbdb, #eeeeee 15%, #333333 75%, #fbfbfb 90%);
}
.iphone .volume.up {
  top: 160px;
}
.iphone .volume.down {
  top: 222px;
}
.iphone .sleep_wake {
  position: absolute;
  bottom: 100%;
  right: 70px;
  width: 60px;
  height: 3px;
  border: 1px solid #888;
  border-bottom: none;
  -moz-border-radius-topleft: 2px;
  -webkit-border-top-left-radius: 2px;
  border-top-left-radius: 2px;
  -moz-border-radius-topright: 2px;
  -webkit-border-top-right-radius: 2px;
  border-top-right-radius: 2px;
  background: url('data:image/svg+xml;base64,pd94bwwgdmvyc2lvbj0ims4wiiblbmnvzgluzz0idxrmltgipz4gphn2zyb2zxjzaw9upsixljeiihhtbg5zpsjodhrwoi8vd3d3lnczlm9yzy8ymdawl3n2zyi+pgrlznm+pgxpbmvhckdyywrpzw50iglkpsjncmfkiibncmfkawvudfvuaxrzpsjvymply3rcb3vuzgluz0jvecigede9ijaumcigete9ijaunsigedi9ijeumcigeti9ijaunsi+phn0b3agb2zmc2v0psiwjsigc3rvcc1jb2xvcj0ii2fhywfhysivpjxzdg9wig9mznnldd0inyuiihn0b3aty29sb3i9iinmzmzmzmyilz48c3rvccbvzmzzzxq9ije1jsigc3rvcc1jb2xvcj0ii2fhywfhysivpjxzdg9wig9mznnldd0inzaliibzdg9wlwnvbg9ypsijzgrkzgrkii8+phn0b3agb2zmc2v0psi4nsuiihn0b3aty29sb3i9iiniymjiymiilz48c3rvccbvzmzzzxq9ijkzjsigc3rvcc1jb2xvcj0ii2vlzwvlzsivpjxzdg9wig9mznnldd0imtawjsigc3rvcc1jb2xvcj0ii2fhywfhysivpjwvbgluzwfyr3jhzgllbnq+pc9kzwzzpjxyzwn0ihg9ijaiihk9ijaiihdpzhropsixmdaliibozwlnahq9ijewmcuiigzpbgw9invybcgjz3jhzckiic8+pc9zdmc+ia==');
  background: -webkit-gradient(linear, 0% 50%, 100% 50%, color-stop(0%, #aaaaaa), color-stop(7%, #ffffff), color-stop(15%, #aaaaaa), color-stop(70%, #dddddd), color-stop(85%, #bbbbbb), color-stop(93%, #eeeeee), color-stop(100%, #aaaaaa));
  background: -moz-linear-gradient(left, #aaaaaa, #ffffff 7%, #aaaaaa 15%, #dddddd 70%, #bbbbbb 85%, #eeeeee 93%, #aaaaaa);
  background: -webkit-linear-gradient(left, #aaaaaa, #ffffff 7%, #aaaaaa 15%, #dddddd 70%, #bbbbbb 85%, #eeeeee 93%, #aaaaaa);
  background: linear-gradient(to right, #aaaaaa, #ffffff 7%, #aaaaaa 15%, #dddddd 70%, #bbbbbb 85%, #eeeeee 93%, #aaaaaa);
}

以上就是基于css3画一个iphone的详细内容,更多关于css3画一个iphone的资料请关注其它相关文章!