Skip to content

Instantly share code, notes, and snippets.

@aaronvanston
Last active February 13, 2016 10:19
Show Gist options
  • Save aaronvanston/6af0a8c886499662bae7 to your computer and use it in GitHub Desktop.
Save aaronvanston/6af0a8c886499662bae7 to your computer and use it in GitHub Desktop.
Browser statistics using only CSS
/* ORIENTATION */
@media (orientation: landscape) {
.stat__orientation:after {
content: "Landscape"
}
}
@media (orientation: portrait) {
.stat__orientation:after {
content: "Portrait";
}
}
/* WIDTH */
$width: 2000;
@for $i from 500 through $width {
@media (min-width: #{$i}px) {
.stat__size-width:after {
content: "#{$i}px";
}
}
}
@media (min-width: 2001px) {
.stat__size-width:after {
content: "Greater than 2000px";
}
}
@media (max-width: 499px) {
.stat__size-width:after {
content: "Less than 500px";
}
}
<div class="container">
<p class="stat__size-width">Size (Width): </p>
<p class="stat__size-height">Size (Height): </p>
<p class="stat__orientation">Orientation: </p>
<p class="stat__medium">Medium: </p>
<p class="stat__colour">Colour: </p>
<p class="stat__resolution">Resolution: </p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment