62 lines
1.5 KiB
Markdown
62 lines
1.5 KiB
Markdown
# HTML Templates in Odin
|
|
|
|
```odin
|
|
page := html()
|
|
{head()
|
|
{title("HTML Title")}
|
|
}
|
|
{body()
|
|
{div()
|
|
class("container")
|
|
{div()
|
|
class("article")
|
|
{h1("Hello, world!")}
|
|
{h6("Goodbye, world!")}
|
|
{
|
|
{div()
|
|
attr("aria-data", "idk!")
|
|
text("Yo, what's up!")
|
|
}
|
|
{div()
|
|
{a("don't be eeeviiiilll", "http://google.com")}
|
|
{a("This link has a class called 'button'")
|
|
class("button")}
|
|
}
|
|
}
|
|
}
|
|
|
|
{img("background.png", "green texture")
|
|
class("img")
|
|
}
|
|
{div()
|
|
id("lol")
|
|
class("hello")
|
|
}
|
|
{text("Random text")}
|
|
{text("")}
|
|
}
|
|
}
|
|
```
|
|
<pre>
|
|
<html>
|
|
<head>
|
|
<title>HTML Title</title>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="article">
|
|
<h1>Hello, world!</h1>
|
|
<h6>Goodbye, world!</h6>
|
|
<div aria-data="idk!">Yo, what's up!</div>
|
|
<div>
|
|
<a href="http://google.com">don't be eeeviiiilll</a>
|
|
<a class="button" href="">This link has a class called 'button'</a>
|
|
</div>
|
|
</div>
|
|
<img class="img" alt="green texture" src="background.png">
|
|
<div class="hello" id="lol"></div>
|
|
Random text
|
|
</div>
|
|
</body>
|
|
</html>
|
|
</pre> |