Skip to content

Instantly share code, notes, and snippets.

@rileyjshaw
Created June 24, 2014 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rileyjshaw/12bb481acd0ab6e97bfa to your computer and use it in GitHub Desktop.
Save rileyjshaw/12bb481acd0ab6e97bfa to your computer and use it in GitHub Desktop.
A Pen by Riley Shaw.
.container
- for i in 1..16
- for j in 1..256
div class="l#{i}"
p.on ON
p OFF

n-input OR gate in CSS

Using an opacity hack as described here. The box will be red if at least one of the inputs is set to 1.

Play with the input vals on line 21.

A Pen by Riley Shaw on CodePen.

License.

@import "compass/css3"
// accepts n {0,1} args to determine l#{n}'s background
=bgs($bools...)
@for $a from 1 through length($bools)
@if nth($bools,$a) == 1
.l#{$a}
background: red
.container
position: fixed
top: 50%
left: 50%
height: 120px
width: 120px
margin: -62px
border: 4px solid black
font: bold 32px/#{60px} sans-serif
text-align: center
color: red
// set input vals here
+bgs(0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0)
div
position: absolute
top: 0
left: 0
height: 100%
width: 100%
opacity: 0.004
background: white
p
position: relative
.on
color: white
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment