- RIOT.JS - Home
- RIOT.JS - Overview
- RIOT.JS - Environment Setup
- RIOT.JS - First Application
- RIOT.JS - Tags
- RIOT.JS - Expressions
- RIOT.JS - Styling
- RIOT.JS - Conditional
- RIOT.JS - Yield
- RIOT.JS - Event Handling
- RIOT.JS - Accessing DOM
- RIOT.JS - Loops
- RIOT.JS - Mixin
- RIOT.JS - Observables
- RIOT.JS Useful Resources
- RIOT.JS - Quick Guide
- RIOT.JS - Useful Resources
- RIOT.JS - Discussion
RIOT.JS - Styling
RIOT js tags can have their own style and we can define styles within tags which will affect only the content within the tag. We can also set a style class using scripts as well within a tag. Following is the syntax how to achieve styling of RIOT tags.
custom1Tag.tag
<custom1Tag>
<h1>{title}</h1>
<h2 class = "subTitleClass">{subTitle}</h2>
<style>
h1 {
color: red;
}
.subHeader {
color: green;
}
</style>
<script>
this.title = "Welcome to TutorialsPoint.COM";
this.subTitle = "Learning RIOT JS";
this.subTitleClass = "subHeader";
</script>
</custom1Tag>
index.htm
<!DOCTYPE html>
<html>
<head>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/riot/3.13.2/riot+compiler.min.js"></script>
</head>
<body>
<h1>Non RIOT Heading</h1>
<custom1Tag></custom1Tag>
<script src = "custom1Tag.tag" type = "riot/tag"></script>
<script>
riot.mount("custom1Tag");
</script>
</body>
</html>
This will produce following result −
Advertisements