Heres a great article about saying hello to the world. only the way everybody else does it -- by saying hello world... only in latin...
qHTML is a simplified, custom representation of HTML designed for ease of reading and maintenance; its syntax resembles CSS but defines HTML structure and attributes inline. Because qHTML is implemented as a custom web component, you simply wrap your markup in a <q-html>
element and it will transform into standard HTML without any boilerplate or JavaScript API. It’s also easy to extend by defining new custom components so you can reuse blocks with custom attributes.
A qHTML document looks like CSS: you write tag names followed by braces, and inside the braces you specify attributes and nested elements. Attributes are assigned using name: "value"
pairs, and the content
property (or synonyms like text
or innertext
) sets the inner text of an element. All valid HTML attributes work, including event handlers like onclick
, and you can nest elements by declaring additional blocks inside braces.
For example:
<script src="qhtml.js"></script>
<q-html>
div {
id: "myDiv"
class: "container"
content: "click the button below for a special message"
button {
onclick: "alert('hello world')"
content: "click me!"
}
}
</q-html>
When the page loads, the qHTML component generates the equivalent HTML:
<div id="myDiv" class="container">
click the button below for a special message
<button onclick="alert('hello world')">click me!</button>
</div>
qHTML also includes optional helpers like simplified nesting (write multiple tags separated by commas), custom components defined with <q-component>
, and a <q-script>
tag for adding event listeners in a concise syntax.
Check out the examples below for a couple of exmaples of features available in qHTML.
<q-html>
tag and it renders automatically.<q-component>
and they become available with all their inline attributes.<q-script>
tag to attach event listeners and write small scripts using CSS selector syntax.prerequisites: q-html.js, w3.css
prerequisites: q-html.js, w3-tags.js
prerequisites: qhtml.js, w3-tags.js Combine unlimited numbers of w3-tags with plain html tags to create complex layouts
Every time you combine two or more tags (separating them with a comma) , it creates a nested structure.
div,span,div { }
is equivalent to
<div> <span> <div> </div> </span> </div>
w3-tags.js creates a uniqe custom element definition for each of the w3-* CSS classes from the w3.css framework.
When you use the custom element tags, the result will be like this.
w3-main,w3-green,div { } w3-main,w3-green,div,w3-blue,div { }
is equivalent to
<div class="w3-main w3-green"></div> <div class="w3-main w3-green"> <div class="w3-blue"> </div> </div>
notice how every html element that doesn't start with w3- becomes the element where the w3-* classes all get applied to.
Heres a great article about saying hello to the world. only the way everybody else does it -- by saying hello world... only in latin...
Heres a great article about saying hello to the world. only the way everybody else does it -- by saying hello world... only in latin...