Skip to content

Commit 4bd4c28

Browse files
author
James Halliday
committed
css javascript example
1 parent 100b79d commit 4bd4c28

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

html.markdown

+16-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ h1 {
183183

184184
use an id when there will only be a single element
185185

186-
``` css
186+
``` html
187187
<html>
188188
<head>
189189
<style>
@@ -268,6 +268,21 @@ but we can do lots of other things with css:
268268

269269
and more! http://www.w3.org/TR/CSS2/selector.html#pattern-matching
270270
---
271+
# css selectors
272+
273+
You can use css selectors directly from javascript:
274+
275+
``` html
276+
<body>
277+
<div id="neat">
278+
<div class="msg">...</div>
279+
</div>
280+
<script>
281+
document.querySelector('#neat .msg').textContent = 'cool!!!!'
282+
</script>
283+
</body>
284+
```
285+
---
271286
# neocities
272287

273288
You can host your html on neocities for free!

0 commit comments

Comments
 (0)