Skip to content

Commit e9b0756

Browse files
author
Marc J. Schmidt
committed
First rough version.
0 parents  commit e9b0756

File tree

3 files changed

+407
-0
lines changed

3 files changed

+407
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CSS Element Queries
2+
===================
3+
4+
A proof-of-concept event-based CSS element dimension query with valid CSS selector syntax.
5+
6+
This means:
7+
8+
- No interval/timeout detection. It's truly event-based.
9+
- No CSS modifications.
10+
- Valid CSS Syntax.
11+
- All CSS selectors available. It used the normal attribute selector.
12+
- Support for webkit/gecko/internet explorer.
13+
- `min-width`, `min-height`, `max-width` and `max-height` are yet supported.
14+
15+
Example
16+
-------
17+
18+
```css
19+
.widget-name {
20+
padding: 25px;
21+
}
22+
.widget-name[max-width="200px"] {
23+
padding: 0;
24+
}
25+
.widget-name[min-width="500px"] {
26+
padding: 55px;
27+
}
28+
```
29+
30+
Info: This is a first very experimental version! You should not use it yet.

demo.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>CSS Element Query</title>
6+
<style>
7+
body {
8+
padding: 35px;
9+
font-size: 12px;
10+
}
11+
12+
.panel {
13+
background-color: #eee;
14+
}
15+
16+
.panel:hover {
17+
padding: 0 150px;
18+
}
19+
20+
.widget-1 {
21+
border: 1px solid silver;
22+
margin: 50px;
23+
padding: 50px;
24+
}
25+
26+
.widget-1[max-width='500px'] {
27+
padding: 5px;
28+
}
29+
30+
.widget-1[min-width~='500px'] {
31+
text-align: center;
32+
padding-left: 100px;
33+
padding-right: 100px;
34+
border: 1px solid blue;
35+
}
36+
37+
.widget-1[min-width~='800px'] {
38+
padding: 5px 300px;
39+
border: 1px solid red;
40+
}
41+
</style>
42+
</head>
43+
<body>
44+
<div class="panel">
45+
<div class="widget-1">
46+
<h2>Widget #1</h2>
47+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
48+
sed diam nonumy eirmod tempor invidunt ut labore et dolore
49+
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
50+
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
51+
no sea takimata sanctus est Lorem ipsum dolor sit amet.<br />
52+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
53+
sed diam nonumy eirmod tempor invidunt ut labore et dolore
54+
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
55+
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
56+
no sea takimata sanctus est Lorem ipsum dolor sit amet.
57+
</div>
58+
</div>
59+
60+
<script src="src/ElementQueries.js"></script>
61+
</body>
62+
</html>

0 commit comments

Comments
 (0)