html,css, js code example
Example 1: how to give css style in javascript
document.getElementById("myH1").style.color = "red";
Example 2: html css javascript
For example:
<div id="me">Click me!</div>
<style>
div {
height: 128px;
width: 128px;
background: red;
}
</style>
<script>
document.getElementById("me".addEventListener("click", function(){
document.getElementById("me").style.background = 'blue';
});
</script>
Example 3: html css js
<!DOCTYPE html>
<html lang="pt-br" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>...</title>
</head>
<body>
...
<script type="text/javascript" src="script.js"></script>
</body>
</html>
Example 4: css in js
JSS is an authoring tool for CSS which allows you to use JavaScript to describe styles in a declarative, conflict-free and reusable way. It can compile in the browser, server-side or at build time in Node.
JSS is framework agnostic. It consists of multiple packages: the core, plugins, framework integrations and others.