<!DOCTYPE html> <html> <head> <title>HTML CSS JS</title> <script> /* CSS styles */ h1 { font-family: Impact, sans-serif; color: #CE5937; } #aboutHtmlClassArray{background-color:whitesmoke;} .htmlClassArray{color:purple;} </script> </head> <body> <h1 id="welcome">HTML CSS JS</h1> <div id="spelling"> <p> In html a less than sign < facing a > greater than sign are considered a tag, < > . With few exceptions, a pair of tags are necessary to make a proper set, one for opening, and one for closing.<br/><br/> The opening tag is < >.<br/> The closing tag has a forward slash / in it before the greater than sign > < / ><br/> Example: <openingTag1of2> <closingTag2of2/> <br/> The exception outside of a pair of tags are self closing tags. These open and close in the same the one tag. < / > It looks like a self closing tag without characters, but the different is with the characters inside, it goes in front of the forward slash versus a closing tag the word goes after the forward slash. Example: <selfClose/> versus </closingTag><br/> The type of tag is based on the name abrreviations inside the tag.<br/> </p> <ol> Pre-defined tags: <li>html <html> </html></li> <li>head <head> </head></li> <li>link a self closing <link/></li> <li>body the document that shows on the browser <body> </body></li> <li>header for inside the body <header> </header></li> <li>h1 short for heading 1, with number attachments to the h ranging from 1 through 6, large to small <h1> <h1/></li> <li>nav short for navigation <nav> </nav></li> <li>a short for anchor for linking <a> </a></li> <li>div note: commonly used to make custom tags <div> </div></li> <li>img short for image self closing <img/></li> <li>paragraph <p> </p></li> <li>ul for unordered list <ul> </ul></li> <li>ol for ordered list <ol> </ol></li> <li>li for list item <li> </li></li> <li>footer <footer> </footer></li> <li>span custom like div but for inline elements specifically <span> </span></li> <li>b for bold <b> </b></li> <li>i for italic <i> </i></li> <li>br for break | self closing <br/></li> </ol> <ul>Getting an element in the different languages we're working with: <li>id="anId" in html | #anId in css | .getElementById('anId') in js NOTE: Here it the words refers to one singular element.</li> <li>class="aClass" in html | #aClass in css | .getElementsByClassName('aClass') in js NOTE: Here it the words refers to more than one element, elements.</li> <li><div> <div/> in html | div in css | .getElementsByTagName('div') in js NOTE: Here it the words refers to more than one element, elements.</li> </ul> </div> <div id="aboutHtmlClassArray"> <p> to get to understanding a class and a class array, we'll have to get to understanding an id. </p> <p> when <b>calling on an id</b> inside of js, it is expected to be directed towards one element because an id in html's purpose is to be for one element. </p> <p> when <b>calling on a class</b> inside of js, it is expected to be directed towards more than one element within one same name, <i>the class name</i>, because a class is in html's purpose is to be for more than one element. </p> <p> In js, <b>an array</b> is a variable or if you would like to say element for now, an element that has more than one element nested in it, associated to this name. Or you can think of it as a parent with children too if you'd like. This, <i>the name of parent</i>, here it is <i>htmlClassArray</i>, has however many children with the same belonging to parent. </p> <p> when calling on a class in js, you are calling on an array. an array uses brackets to surround its' nested element. so when first calling on you are just calling on the array object itself, access being the just brackets itself. Like a box delivered with lets say 3 contents inside it. you'll first access the box. now how to access the contents, then you have to open it and choose which content to get. </p> </div> <div class="htmlClassArray"> This is <i>htmlClassArray</i> element <i>zero</i> : </div> <div class="htmlClassArray"> This is <i>htmlClassArray</i> element <i>one</i> : </div> <div class="htmlClassArray"> This is <i>htmlClassArray</i> element <i>two</i> : </div> <div class="htmlClassArray"> This is <i>htmlClassArray</i> element <i>three</i> : </div> <script> // JavaScript document.getElementById('aboutHtmlClassArray').style.padding = "20px"; // JavaScript //document.getElementsByClassName('htmlClassArray').style.backgroundColor = "blue"; var ahtmlClassArray = document.getElementsByClassName('htmlClassArray'); ahtmlClassArray.innerText += " index 0, element 1 of 4"; ahtmlClassArray[1].style.backgroundColor = "#ccc"; ahtmlClassArray[2].style.backgroundColor = "#ffc"; ahtmlClassArray[3].style.backgroundColor = "#ef1"; ahtmlClassArray[2].style.backgroundColor = "#c22"; </script> </body> </html>
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>