<!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 &lt; facing a &gt; greater than sign
      are considered a tag, &lt; &gt; .
      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  &lt; &gt;.<br/>
      The closing tag has a forward slash &#47; in it before the greater than sign &gt;
      &lt; &#47; &gt;<br/>
      Example: &lt;openingTag1of2&gt; &lt;closingTag2of2&#47;&gt; <br/>
      The exception outside of a pair of tags are self closing tags. These open and close in the same 
      the one tag. &lt; &#47; &gt; 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: &lt;selfClose&#47;&gt; versus &lt;&#47;closingTag&gt;<br/>
      The type of tag is based on the name abrreviations inside the tag.<br/>
    </p>  
    <ol>
        Pre-defined tags:
      <li>html &lt;html&gt; &lt;&#47;html&gt;</li>
      <li>head &lt;head&gt; &lt;&#47;head&gt;</li>
      <li>link a self closing &lt;link&#47;&gt;</li>
      <li>body the document that shows on the browser &lt;body&gt; &lt;&#47;body&gt;</li>
      <li>header for inside the body &lt;header&gt; &lt;&#47;header&gt;</li>
      <li>h1 short for heading 1, with number attachments to the h ranging from 1 through 6, large to small &lt;h1&gt; &lt;h1&#47;&gt;</li>
      <li>nav short for navigation &lt;nav&gt; &lt;&#47;nav&gt;</li>
      <li>a short for anchor for linking &lt;a&gt; &lt;&#47;a&gt;</li>
      <li>div note: commonly used to make custom tags
      &lt;div&gt; &lt;&#47;div&gt;</li>
      <li>img short for image self closing &lt;img&#47;&gt;</li>
      <li>paragraph &lt;p&gt; &lt;&#47;p&gt;</li>
      <li>ul for unordered list &lt;ul&gt; &lt;&#47;ul&gt;</li>
      <li>ol for ordered list &lt;ol&gt; &lt;&#47;ol&gt;</li>
      <li>li for list item &lt;li&gt; &lt;&#47;li&gt;</li>
      <li>footer  &lt;footer&gt; &lt;&#47;footer&gt;</li>
      <li>span custom like div but for inline elements specifically &lt;span&gt; &lt;&#47;span&gt;</li>
      <li>b for bold &lt;b&gt; &lt;&#47;b&gt;</li>
      <li>i for italic &lt;i&gt; &lt;&#47;i&gt;</li>
      <li>br for break | self closing &lt;br&#47;&gt;</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>&lt;div&gt; &lt;div&#47;&gt; 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> 

HTML Online Editor & Compiler

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.

About HTML

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.

Syntax help

Fundamentals

  • Any HTML document must start with document declaration <!DOCTYPE html>
  • HTML documents begin with <html> and ends with </html>
  • Headings are defined with <h1> to <h6> where <h1> is the highest important heading and <h6> is the least important sub-heading.
  • Paragrahs are defined in <p>..</p> tag.
  • Links are defined in <a> tag.

    Example:

    <a href="https://onecompiler.com/html">HTML online compiler</a>
    
  • Images are defined in <img> tag, where src attribute consists of image name.
  • Buttons are defined in <button>..</button> tag
  • Lists are defined in <ul> for unordered/bullet list and <ol> for ordered/number list, and the list items are defined in <li>.

HTML Elements and Attributes

  • HTML element is everything present from start tag to end tag.
  • The text present between start and end tag is called HTML element content.
  • Anything can be a tagname but it's preferred to put the meaningful title to the content present as tag name.
  • Do not forget the end tag.
  • Elements with no content are called empty elements.
  • Elements can have attributes which provides additional information about the element.
  • In the below example, href is an attribute and a is the tag name.

    Example:

    <a href="https://onecompiler.com/html">HTML online compiler</a>
    

CSS

CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.

Example:

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;
}

HTML Tables

  • HTML Tables are defined in <table> tag.
  • Table row should be defined in <tr> tag
  • Table header should be defined in <th> tag
  • Table data should be defined in <td> tag
  • Table caption should be defined in <caption> tag

HTML-Javascript

  • Javascript is used in HTML pages to make them more interactive.
  • <script> is the tag used to write scripts in HTML
  • You can either reference a external script or write script code in this tag.

Example

<script src="script.js"></script>