blob: 9df28794a558a2251597782c8d82d8a925efa964 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>dir() selector</title>
<style>
:not(:dir(rtl)) + div { color: blue }
div { color: lime; text-align: left; }
</style>
<script type="text/javascript">
function switchDir()
{
theDiv = document.getElementById("d");
if (theDiv.dir == "ltr") {
theDiv.dir = "rtl";
} else if (theDiv.dir == "rtl") {
theDiv.dir = "ltr";
}
}
</script>
</head>
<body onload="switchDir()">
<div id="d" dir="ltr">This element is rtl.</div>
<div>This element has default direction.</div>
</body>
</html>
|