Syntax¶
Description: A logical operator is defined as a logical query combinator.
ctr('<#selector>', {
media: {
query: {
<logical:operator>: {
<...>: <...>
}
}
<...>: <...>
}
})
<#selector>:
media:
query:
<logical:operator>:
<...>: <...>
<...>: <...>
@media (<...>: <...>) <logical:operator> (<...>: <...>) {
<#selector> {
<...>: <...>;
}
}
Notes
And¶
Description: An andCondition Object combines its key-value pairs with an and logical operator.
Edit
ctr('.test', {
background: teal
media: {
query: {
andCondition: {
min-width: 200px
max-width: 400px
}
}
background: red
}
})
.test:
background: teal
media:
query:
andCondition:
min-width: 200px
max-width: 400px
background: red
.test {
background: #008080;
}
@media (min-width: 200px) and (max-width: 400px) {
.test {
background: #f00;
}
}
ctr('.test', {
background: teal
media: {
query: {
andCondition: {
min-width: 200px
max-width: 400px
}
}
background: red
}
})
.test {
background: #008080;
}
@media (min-width: 200px) and (max-width: 400px) {
.test {
background: #f00;
}
}
.test:
background: teal
media:
query:
andCondition:
min-width: 200px
max-width: 400px
background: red
Notes
andConditionalias:andCond- The default logical operator if no condition is specified
- Condition: If the
windowwidthis greater than200pxandless than400px, then thebackgroundof.testisred
Or¶
Description: An orCondition Object combines its key-value pairs with an , (or) logical operator.
Edit
ctr('.test', {
background: teal
media: {
query: {
orCondition: {
max-width: 400px 30vw
}
}
background: red
}
})
.test:
background: teal
media:
query:
orCondition:
max-width: [400px, 30vw]
background: red
.test {
background: #008080;
}
@media (max-width: 30vw), (max-width: 400px) {
.test {
background: #f00;
}
}
ctr('.test', {
background: teal
media: {
query: {
orCondition: {
max-width: 400px 30vw
}
}
background: red
}
})
.test {
background: #008080;
}
@media (max-width: 30vw), (max-width: 400px) {
.test {
background: #f00;
}
}
.test:
background: teal
media:
query:
orCondition:
max-width: [400px, 30vw]
background: red
Notes
orConditionalias:orCond- Condition: If the
windowwidthis less than30vwor400px, then thebackgroundof.testisred
And With Or¶
Description: andCondition and orCondition can be used together.
Edit
ctr('.test', {
width: 200px
media: {
query: {
andCondition: {
min-width: 400px 40vw
}
orCondition: {
max-height: 400px 40vh
}
}
background: red
}
})
.test:
width: 200px
media:
query:
andCondition:
min-width: [400px, 40vw]
orCondition:
max-height: [400px, 40vh]
background: red
.test {
width: 200px;
}
@media (min-width: 40vw) and (min-width: 400px) and (max-height: 40vh), (max-height: 400px) {
.test {
background: #f00;
}
}
ctr('.test', {
width: 200px
media: {
query: {
andCondition: {
min-width: 400px 40vw
}
orCondition: {
max-height: 400px 40vh
}
}
background: red
}
})
.test {
width: 200px;
}
@media (min-width: 40vw) and (min-width: 400px) and (max-height: 40vh), (max-height: 400px) {
.test {
background: #f00;
}
}
.test:
width: 200px
media:
query:
andCondition:
min-width: [400px, 40vw]
orCondition:
max-height: [400px, 40vh]
background: red
Notes
- Condition: If the
windowwidthis greater than40vwand400pxandtheheightis less than40vhor400px, then thebackgroundof.testisred
And With Mixin¶
Description: An andCondition can be used in combination with a mixin.
Edit
ctr('.test', {
width: 200px
media: {
query: {
andCondition: {
above: 'sm'
min-height: 200px
}
}
background: red
}
})
.test:
width: 200px
media:
query:
andCondition:
above: sm
min-height: 200px
background: red
.test {
width: 200px;
}
@media (min-width: 600px) and (min-height: 200px) {
.test {
background: #f00;
}
}
ctr('.test', {
width: 200px
media: {
query: {
andCondition: {
above: 'sm'
min-height: 200px
}
}
background: red
}
})
.test {
width: 200px;
}
@media (min-width: 600px) and (min-height: 200px) {
.test {
background: #f00;
}
}
.test:
width: 200px
media:
query:
andCondition:
above: sm
min-height: 200px
background: red
Notes
- Condition: If the
windowwidthisabove<sm>:600pxandtheheightis greater than200pxls - then the
backgroundof.testisred
Or With Mixin¶
Description: An orCondition can be used in combination with a mixin.
Edit
ctr('.test', {
width: 200px
media: {
query: {
orCondition: {
above: 'sm'
min-height: 20vh
}
}
background: red
}
})
.test:
width: 200px
media:
query:
orCondition:
above: sm
min-height: 20vh
background: red
.test {
width: 200px;
}
@media (min-width: 600px), (min-height: 20vh) {
.test {
background: #f00;
}
}
ctr('.test', {
width: 200px
media: {
query: {
orCondition: {
above: 'sm'
min-height: 20vh
}
}
background: red
}
})
.test {
width: 200px;
}
@media (min-width: 600px), (min-height: 20vh) {
.test {
background: #f00;
}
}
.test:
width: 200px
media:
query:
orCondition:
above: sm
min-height: 20vh
background: red
Notes
- Condition: If the
windowwidthisabove<sm>:600pxortheheightis greater than200px, then thebackgroundof.testisred