Skip to content

Instantly share code, notes, and snippets.

@chrisdrackett
Created July 27, 2013 05:26
Show Gist options
  • Save chrisdrackett/6093829 to your computer and use it in GitHub Desktop.
Save chrisdrackett/6093829 to your computer and use it in GitHub Desktop.
SASS iPhone
=iphone($width:320px)
$screen_width: $width
$screen_height: $screen_width * 1.7948717949
$iphone_width: $screen_width * 1.11111
$iphone_height: $screen_height * 1.3261904762
$iphone_buttons: $screen_width * 0.024
.iphone
position: relative
width: $iphone_width + $iphone_buttons
height: $iphone_height + $iphone_buttons
*
position: absolute
.power, .lock, .plus, .minus
background-color: #ebebeb
.power
+border-top-radius($iphone_buttons/2)
right: $screen_width * 0.1730769231
top: 0
width: $screen_width * 0.1730769231
height: $iphone_buttons
.buttons
left: $iphone_buttons/2
top: $screen_width * 0.2692307692
.lock, .plus, .minus
+border-left-radius($iphone_buttons/1.5)
width: $iphone_buttons - 2px
height: $screen_width * 0.1
.lock
height: $screen_width * 0.1153846154
.plus
margin-top: $screen_width * 0.1807692308
.minus
margin-top: $screen_width * 0.3653846154
.phone
top: $iphone_buttons
left: $iphone_buttons
+border-radius($screen_width * 0.1538461538)
background-color: #fcfcfc
width: $iphone_width
height: $iphone_height
+box-shadow(rgba(0,0,0,0.05) ($screen_width * 0.0538461538) ($screen_width * 0.0538461538) 0)
.camera, .speaker
+border-radius($screen_width * 0.1538461538)
.camera
top: $iphone_width * 0.07
left: $iphone_width/2 - $iphone_buttons
height: $iphone_buttons*2
width: $iphone_buttons*2
background-color: #464341
.speaker
top: $screen_width * 0.17
left: $iphone_width/2 - ($screen_width * 0.1807692308)/2
height: $screen_width * 0.03
width: $screen_width * 0.1807692308
background-color: #cfcfcf
.screen
width: $screen_width
height: $screen_height
left: ($iphone_width - $screen_width)/2
top: $screen_width * 0.2615384615
background-color: black
.home
border: 1px solid #f3f3f3
+border-radius($screen_width * 0.1538461538)
width: $screen_width * 0.23
height: $screen_width * 0.23
left: $iphone_width/2 - ($screen_width * 0.2)/2
bottom: $screen_width * 0.055
.icon
+border-radius($screen_width * 0.0192307692)
border: ($screen_width * 0.009) solid #d8d8d8
width: $screen_width * 0.09
height: $screen_width * 0.09
left: 50%
top: 50%
margin-left: -($screen_width * 0.09)/2
margin-top: -($screen_width * 0.09)/2
@chrisdrackett
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment