<div foo="bar">1</div>
<div foo="baz">2</div>
div[foo="bar"] {
background: green;
}
<div>1</div>
<div id="foo">2</div>
#foo:before {
content: "♥ "
}
<div class="foo">foo</div>
<div class="bar">bar</div>
<div class="baz">baz</div>
<div class="foo">foo</div>
.bar ~ .foo {
background: green;
}
<input type="text" value="Tim" />
<div id="result"></div>
input[value="Tim"] ~ #result:before {
content: "Tim Carry";
}
<input type="text" value=""/>
<div id="result"></div>
input[value="Tim"] ~ #result:before {
content: "Tim Carry";
}
<input type="text" oninput="this.setAttribute('value', this.value)" />
input[value="tim" i] ~ #result:before {
content: "Tim Carry";
}
input[value="emily" i] ~ #result:before {
content: "Emily Hayman";
}
input[value="kumiko" i] ~ #result:before {
content: "Kumiko Larroque";
}
input[value="tim" i] ~ #result:before {
content: "Tim Carry";
}
input[value="emily" i] ~ #result:before {
content: "Emily Hayman";
}
input[value="kumiko" i] ~ #result:before {
content: "Kumiko Larroque";
}
input[value="t" i] ~ #result:before,
input[value="ti" i] ~ #result:before,
input[value="tim" i] ~ #result:before,
input[value="c" i] ~ #result:before,
input[value="ca" i] ~ #result:before,
input[value="car" i] ~ #result:before,
input[value="carr" i] ~ #result:before,
input[value="carry" i] ~ #result:before {
content: "Tim Carry";
}
<input type="text" id="input"/>
<div id="results">
<div id="result_1"></div>
<div id="result_2"></div>
<div id="result_3"></div>
</div>
//Pre-fill results
#result_1:before { content: "Julien Lemoine"; }
#result_2:before { content: "Josh Dzielak"; }
#result_3:before { content: "Jonas Badalic"; }
// Hide them all
#results div { display: none; }
// Display some on specific queries
#input[value="jo" i] ~ #results #result_2,
#input[value="jo" i] ~ #results #result_3 {
display: block;
}
<div id="result_42"></div>
#result_42 {
&:before {
content: "Gianluca Bargelli Full-Stack Engineer";
}
}
#result_42 {
&:before {
content: "Gianluca Bargelli \A Full-Stack Engineer";
white-space: pre;
}
&:first-line {
font-weight: bold;
}
}
#result_42:before {
content: "Gianluca Bargelli \A Full-Stack Engineer";
}
#result_42:before {
content: "\e647 \e669 \e661 \e66e luca Bargelli \A Full-Stack Engineer";
}
<div id="result_1"></div>
<div id="result_2"></div>
<div id="result_3"></div>
div { flex: 1; }
#result_1 { order: 3; }
#result_2 { order: 1; }
#result_3 { order: 2; }
#result_1 { order: 4; }
#result_2 { order: 8; }
#result_3 { order: 15; }
#result_4 { order: 16; }
#result_5 { order: 23; }
#result_6 { order: 42; }
[…]