<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<link href="https://front.code-maven.com/atom" rel="self" />
<title>Front-end Maven</title>
<id>https://front.code-maven.com</id>
<updated>2018-01-01T07:30:02</updated>

  <entry>
    <title>jQuery</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2018-01-01T07:30:02Z</updated>
    <pubDate>2018-01-01T07:30:02Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/jquery-skeleton" />
    <id>https://front.code-maven.com/jquery-skeleton</id>
    <content type="html"><![CDATA[<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/jquery/index.html">examples/jquery/index.html</a></strong></p>
<pre><code class="language-html">&lt;html&gt;
  &lt;head&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&quot;&gt;&lt;/script&gt;
        &lt;script type=&quot;text/javascript&quot; src=&quot;code.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1 id=&quot;title&quot;&gt;&lt;/h1&gt;
  &lt;/body&gt;
&lt;/html&gt;
&lt;script&gt;
console.log(&quot;hello&quot;);
&lt;/script&gt;

</code></pre>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/jquery/code.js">examples/jquery/code.js</a></strong></p>
<pre><code class="language-js">$(document).ready(function(){
    $(&quot;#title&quot;).html(&quot;Hello jQuery&quot;);
}); 

</code></pre>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>Custom HTML Attributes</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2016-08-31T09:00:01Z</updated>
    <pubDate>2016-08-31T09:00:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/custom-html-attributes" />
    <id>https://front.code-maven.com/custom-html-attributes</id>
    <content type="html"><![CDATA[<p>If you are familiar with HTML, and the valid attributes of most of the elements,
you probably also know that if you provide an attribute that is not one of the official
attributes of that element the browsers will disregard it.</p>
<p>What you might not know is that those attributes are still parsed and are still part of
the DOM, the <a href="https://en.wikipedia.org/wiki/Document_Object_Model">Document Object Model</a>.</p>
<p>That is, they are still accessible by JavaScript running in the browser.</p>
<p>Let's see an example.</p>
<p>In the following HTML file we have an <code>h1</code> element and some text.
If you click on the 'try' link you'll be able to see how that is displayed in your brower.
It shows the text within the <code>h1</code> element with bigger letters, because that's what
we expect from a header element.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/html_attribute_h1.html">examples/html/html_attribute_h1.html</a></strong></p>
<pre><code class="language-html">&lt;h1&gt;Hello World&lt;/h1&gt;
&lt;p&gt;And include some text as well&lt;/p&gt;

</code></pre>
<p><a href="examples/html/html_attribute_h1.html">view</a></p>
<p>We can add a <code>style</code> attribute and within that we can add CSS instructions.
For example we can tell the browser to use smaller fonts for the <code>h1</code> element:</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/html_attribute_style.html">examples/html/html_attribute_style.html</a></strong></p>
<pre><code class="language-html">&lt;h1 style=&quot;font-size: 12px&quot;&gt;Hello World&lt;/h1&gt;
&lt;p&gt;And include some text as well&lt;/p&gt;


</code></pre>
<p><a href="examples/html/html_attribute_style.html">view</a></p>
<p>This works because <code>style</code> is a known attribute of <code>h1</code> and for
that matter for every HTML element.</p>
<h2 class="title is-4">Custom attribute</h2>
<p>In the next example removed the <code>style</code> attribute and added a different
attribute, called <code>secret-sauce</code>. If you open the html in a
browser you'll see that the content of the <code>h1</code> element returned to
it original size, and you won't see any impact of the new attribute.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/custom_html_attribute.html">examples/html/custom_html_attribute.html</a></strong></p>
<pre><code class="language-html">&lt;h1 secret-sauce=&quot;This is JavaScript&quot;&gt;Hello World&lt;/h1&gt;
&lt;p&gt;And include some text as well&lt;/p&gt;


</code></pre>
<p><a href="examples/html/custom_html_attribute.html">view</a></p>
<p>No warnings, no errors. That's because the browser simply disregards those attributes.</p>
<h2 class="title is-4">Attributes are in the DOM</h2>
<p>While the browser seems to disregard the existance of this attribute, it actually
parses it and puts it on the DOM. Meaning we can access this attribute using JavaScript.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/custom_html_attribute_show.html">examples/html/custom_html_attribute_show.html</a></strong></p>
<pre><code class="language-html">&lt;h1 secret-sauce=&quot;This is JavaScript&quot;&gt;Hello World&lt;/h1&gt;
&lt;p&gt;And include some text as well&lt;/p&gt;

&lt;script&gt;
var h1 = document.getElementsByTagName('h1')[0];

console.log(h1.getAttribute('secret-sauce'));
&lt;/script&gt;

</code></pre>
<p><a href="examples/html/custom_html_attribute_show.html">view</a></p>
<p>Using <code>document.getElementsByTagName</code> we fetch the list of all the
<code>h1</code> elements in the document and the we use the index <code>[0]</code> to
access the first such element. On that element we use the <code>getAttribute</code>
method to access the value of the given attribute.</p>
<p>Then we use <code>console.log</code> to print it. click on the 'Try' link and in
the new window
<a href="/open-javascript-console">open the JavaScript console</a> to see the value.</p>
<h2 class="title is-4">data-* attributes</h2>
<p>HTML5 defined a set of attributes using the prefix <code>data-</code> that get special treatment.
They are not used by the browser, but they, (the broswers) provide access to them through special
syntax. The objects representing the HTML tags that we retreive from the DOM of modern browsers
have a standard attribute called <code>dataset</code> that provides access to all the <code>data-*</code>
attributes as in this example:</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/custom_html_attribute_show_data.html">examples/html/custom_html_attribute_show_data.html</a></strong></p>
<pre><code class="language-html">&lt;h1 data-secret-sauce=&quot;This is JavaScript&quot;&gt;Hello World&lt;/h1&gt;
&lt;p&gt;And include some text as well&lt;/p&gt;

&lt;script&gt;
var h1 = document.getElementsByTagName('h1')[0];

console.log(h1.dataset.secretSauce);
console.log(h1.getAttribute('data-secret-sauce'));
&lt;/script&gt;

</code></pre>
<p><a href="examples/html/custom_html_attribute_show_data.html">view</a></p>
<p>As you might have noticed however, the names of the attributes in the HTML and the names
we use in JavaScript to access them are not exactly the same. That's because JavaScript
cannot have dash <code>-</code> in attribute names when using the <code>.</code> syntax.</p>
<p>So the attribute name called <code>data-secret-sauce</code> in the HTML is accessible as
<code>dataset.secretSauce</code> in the JavaScript code.</p>
<p>Another issue with this special syntax is that Internet Explorer started to support this
only in version 11. For older version you'll still have to use the regular <code>getAttribute</code>
syntax.</p>
<p>For further examples check out the
<a href="https://developer.mozilla.org/en/docs/Web/Guide/HTML/Using_data_attributes">guide from Mozilla</a>.</p>
<h2 class="title is-4">ng-* custom attributes used by AngularJS</h2>
<p><a href="/angularjs">AngularJS</a> uses the <code>ng-</code> prefix
for all the custom attributes. This makes it clear to the reader that something
is related to AngularJS.</p>
<p>Actually Angular will also work with attributes using <code>data-ng-</code> prefix, in case
you'd like to stick to the HTML specifications.</p>
<h2 class="title is-4">Caveat</h2>
<p>The problem with the arbitrary attribute names is that if two JavaScript libraries happen to rely
on the same attribute name and we try to use the two libraries in the same HTML file, then those
two will collide. Using some kind of project-specific prefix, such as the <code>ng-</code> in case
of AngularJS, can reduce the risk of this problem.</p>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>AngularJS Skeleton</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2016-05-06T13:40:01Z</updated>
    <pubDate>2016-05-06T13:40:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/angular-skeleton" />
    <id>https://front.code-maven.com/angular-skeleton</id>
    <content type="html"><![CDATA[<p>A simple <a href="https://angularjs.org/">AngularJS</a> skeleton.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/angular-skeleton.html">examples/html/angular-skeleton.html</a></strong></p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot;
     content=&quot;width=device-width, initial-scale=1, user-scalable=yes&quot;&gt;
  &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js&quot;&gt;&lt;/script&gt;

  &lt;script&gt;
   angular.module('DemoApp', [])
   .controller('DemoController', ['$scope', function($scope) {
       $scope.message = &quot;Hello World&quot;;
   }]);
  
  &lt;/script&gt;

&lt;/head&gt;
&lt;body ng-app=&quot;DemoApp&quot; ng-controller=&quot;DemoController&quot;&gt;

&lt;h1&gt;Main Title&lt;/h1&gt;
{{message}}

&lt;/body&gt;
&lt;/html&gt;



</code></pre>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>Skeletons</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2015-12-25T08:00:01Z</updated>
    <pubDate>2015-12-25T08:00:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/skeletons" />
    <id>https://front.code-maven.com/skeletons</id>
    <content type="html"><![CDATA[<p>When you start writing a project it is much easier to start with a skeleton than to stare at a blank page.
This is a collection of skeletons you might find useful.</p>
<ul>
<li><a href="/html-skeleton">HTML 5 skeleton</a></li>
<li><a href="/bootstrap-skeleton">Bootstrap Skeleton</a></li>
<li><a href="/jquery-skeleton">JQuery skeleton</a></li>
<li><a href="/angular-skeleton">AngularJS Skeleton</a></li>
<li><a href="/angular-ui-bootstrap-skeleton">AngularJS UI Bootstrap Skeleton</a></li>
<li><a href="https://perlmaven.com/dancer2-angularjs-single-page-application">Perl Dancer + AngularJS + Bootstrap skeleton</a></li>
<li><a href="https://code-maven.com/minimal-example-generating-html-with-python-jinja">Skeleton: A minimal example generating HTML with Python Jinja</a></li>
</ul>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>AngularJS UI with Bootstrap Skeleton</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2015-12-24T20:00:01Z</updated>
    <pubDate>2015-12-24T20:00:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/angular-ui-bootstrap-skeleton" />
    <id>https://front.code-maven.com/angular-ui-bootstrap-skeleton</id>
    <content type="html"><![CDATA[<p>To make <a href="https://angularjs.org/">AngularJS</a> and <a href="http://getbootstrap.com/">Bootstrap</a> work nicely together
you can use the <a href="https://angular-ui.github.io/bootstrap/">Angular UI Bootstrap</a> project.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/angular-ui-bootstrap-skeleton.html">examples/html/angular-ui-bootstrap-skeleton.html</a></strong></p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot;
     content=&quot;width=device-width, initial-scale=1, user-scalable=yes&quot;&gt;
  &lt;link href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&gt;
  &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.14.3/ui-bootstrap-tpls.min.js&quot;&gt;&lt;/script&gt;

  &lt;script&gt;
   angular.module('DemoApp', [])
   .controller('DemoController', function($scope) {
       $scope.message = &quot;Hello World&quot;;
   });
  
  &lt;/script&gt;

&lt;/head&gt;
&lt;body ng-app=&quot;DemoApp&quot; ng-controller=&quot;DemoController&quot;&gt;

&lt;div class=&quot;container-fluid&quot;&gt;
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-md-10&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;

  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-md-2&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-md-7&quot;&gt;
        &lt;h1&gt;Main Title&lt;/h1&gt;
        &lt;h2&gt;Sub title&lt;/h2&gt;
        {{message}}
      &lt;/div&gt;
      &lt;div class=&quot;col-md-3&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;


</code></pre>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>Bootstrap Skeleton</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2015-12-24T19:00:01Z</updated>
    <pubDate>2015-12-24T19:00:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/bootstrap-skeleton" />
    <id>https://front.code-maven.com/bootstrap-skeleton</id>
    <content type="html"><![CDATA[<p><a href="http://getbootstrap.com/">Bootstrap</a> is an HTML framework that makes it easy to build good looking, mobile-friendly web sites.
You can start using it with this skeleton, or you can download the respective files and serve them from your own server.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/bootstrap-skeleton.html">examples/html/bootstrap-skeleton.html</a></strong></p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot;
     content=&quot;width=device-width, initial-scale=1, user-scalable=yes&quot;&gt;
  &lt;link href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&gt;
  &lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;div class=&quot;container-fluid&quot;&gt;
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-md-10&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-md-1&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;

  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-md-2&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;col-md-7&quot;&gt;
        &lt;h1&gt;Main Title&lt;/h1&gt;
        &lt;h2&gt;Sub title&lt;/h2&gt;
      &lt;/div&gt;
      &lt;div class=&quot;col-md-3&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;


</code></pre>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>HTML 5 Skeleton</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2015-12-24T18:00:01Z</updated>
    <pubDate>2015-12-24T18:00:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/html-skeleton" />
    <id>https://front.code-maven.com/html-skeleton</id>
    <content type="html"><![CDATA[<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/html5-skeleton.html">examples/html/html5-skeleton.html</a></strong></p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, user-scalable=yes&quot;&gt;
  &lt;link href=&quot;/css/skeleton.css&quot; rel=&quot;stylesheet&quot;&gt;
  &lt;script src=&quot;/js/skeleton.js&quot;&gt;&lt;/script&gt;

  &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Main subject&lt;/h1&gt;

&lt;/body&gt;
&lt;/html&gt;


</code></pre>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/css/skeleton.css">examples/html/css/skeleton.css</a></strong></p>
<pre><code class="language-css">h1 {
    font-size: 30px;
}

</code></pre>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/js/skeleton.js">examples/html/js/skeleton.js</a></strong></p>
<pre><code class="language-js">console.log(&quot;Hello World&quot;);

</code></pre>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>Hello World in plain HTML</title>
    <summary type="html"><![CDATA[The text for the search engines]]></summary>
    <updated>2015-11-07T11:30:01Z</updated>
    <pubDate>2015-11-07T11:30:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/hello-world-in-plain-html" />
    <id>https://front.code-maven.com/hello-world-in-plain-html</id>
    <content type="html"><![CDATA[<p>The first step in building web applications is to learn about HTML and the first thing there is to
learn is to create an HTML file showing <strong>Hello World!</strong>.</p>
<h2 class="title is-4">Plain text as HTML</h2>
<p>As you can read in the <a href="/html-basics">HTML Basics</a>, even plain text can be considered to be <code>HTML</code>.
If we create a file with <code>.html</code> and open it with a web browser such as Firefox, Chrome, Opera, Safari, or even Internet Explorer,
then the browser will try to do its best to display the content of the file as HTML.</p>
<p>Therefore the most simple solution is to create a file with <code>.html</code> and have the following content in it:</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/hello_world.html">examples/html/hello_world.html</a></strong></p>
<pre><code class="language-html">Hello World!

</code></pre>
<p><a href="examples/html/hello_world.html">view</a></p>
<p>You can either click on the &quot;try&quot; link to see it working, or you can copy the content of the example and open it
from your hard disk using the <strong>File/Open</strong> menu option of your browser.</p>
<h2 class="title is-4">HTML 5 skeleton</h2>
<p>A better solution is to provide a full HTML5 skeleton.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/html/hello_world_html5.html">examples/html/hello_world_html5.html</a></strong></p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta charset=&quot;utf-8&quot;&gt;
  &lt;meta name=&quot;viewport&quot;
     content=&quot;width=device-width, initial-scale=1, user-scalable=yes&quot;&gt;

  &lt;title&gt;Hello World!&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
Hello World!

&lt;/body&gt;
&lt;/html&gt;

</code></pre>
<p><a href="examples/html/hello_world_html5.html">view</a></p>
<p>In this example we have &quot;Hello World!&quot; twice. The one in the <code>title</code> element is the
one that is displayed on &quot;tab&quot; of the web browser or on the frame of the window showing the web browser.</p>
<p>The one inside the <code>body</code> element is the one that we usually see in the browser.</p>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>About</title>
    <summary type="html"><![CDATA[About this site]]></summary>
    <updated>2015-10-11T12:30:02Z</updated>
    <pubDate>2015-10-11T12:30:02Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/about" />
    <id>https://front.code-maven.com/about</id>
    <content type="html"><![CDATA[<p>This is the skeleton of an about page</p>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>Front-End Maven</title>
    <summary type="html"><![CDATA[The text for the search engines]]></summary>
    <updated>2015-10-11T12:30:01Z</updated>
    <pubDate>2015-10-11T12:30:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/" />
    <id>https://front.code-maven.com/</id>
    <content type="html"><![CDATA[<p>This is the main page of your site.</p>
<h2 class="title is-4">Books</h2>
<ul>
<li><a href="/css/">CSS</a></li>
<li><a href="/javascript/">JavaScript</a></li>
<li><a href="/vue/">Vue</a></li>
</ul>
<h2 class="title is-4">Recent posts</h2>
<ul>
<li><a href="/jquery-skeleton">jQuery</a></li>
<li><a href="/custom-html-attributes">Custom HTML Attributes</a></li>
<li><a href="/angular-skeleton">AngularJS Skeleton</a></li>
<li><a href="/skeletons">Skeletons</a></li>
<li><a href="/angular-ui-bootstrap-skeleton">AngularJS UI with Bootstrap Skeleton</a></li>
</ul>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

  <entry>
    <title>HTML basics</title>
    <summary type="html"><![CDATA[]]></summary>
    <updated>2015-06-01T15:10:01Z</updated>
    <pubDate>2015-06-01T15:10:01Z</pubDate>
    <link rel="alternate" type="text/html" href="https://front.code-maven.com/html-basics" />
    <id>https://front.code-maven.com/html-basics</id>
    <content type="html"><![CDATA[<p>In the first episode we are going to look at the basics of HTML, the language that allows us to describe the
structure of a web page.</p>
<h2 class="title is-4">What you need</h2>
<p>You'll need a web browser such as <a href="https://www.google.com/chrome/browser/desktop/">Chrome</a> or <a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a>.</p>
<p>You'll also need a text editor. If you are using Microsoft Windows you can use <a href="https://notepad-plus-plus.org/">Notepad++</a>.
On Mac OSX I hear <a href="http://www.barebones.com/products/textwrangler/">TextWrangler</a> is a nice editor.
On Linux you might want to use Gedit.</p>
<p>Create a directory called 'tso' somewhere on your computer. It can be on the Desktop, or directly on drive <code>c:\</code>. For now, the only important thing is that you'll easily find that directory. Open the editor, start a new document. Type in the following line:</p>
<pre><code>Welcome to the Spaceship Operator!
</code></pre>
<p>Then save the file in the <code>tso</code> directory calling it <code>index.html</code>.</p>
<p>Now switch to your browser and open the <code>index.html</code> in the browser. You'll seee the same line that you typed in the file.</p>
<pre><code>Welcome to the Spaceship Operator!
</code></pre>
<p>This is the first HTML file you created. It does not contain any special character that would indicate that it is an HTML file,
but that's ok.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/tso/1/index.html">examples/tso/1/index.html</a></strong></p>
<pre><code class="language-html">Welcome to the Spaceship Operator!
</code></pre>
<p><a href="examples/tso/1/index.html">view</a></p>
<h2 class="title is-4">Second line</h2>
<p>Now let's add a second line to the text file and save it again. The content in the editor will look like this:</p>
<pre><code class="language-html">Welcome to the Spaceship Operator!
Following this series of articles you'll learn programming.
</code></pre>
<p>If you now open the file with the browser again you'll see only one line:</p>
<pre><code>Welcome to the Spaceship Operator! Following this series of articles you'll learn programming.
</code></pre>
<p>That happen because the browsers disregard multiple so called &quot;white-spaces&quot; and uses a single &quot;space&quot; instead of them. A &quot;white-space&quot; is something that we normally cannot see. For example a real &quot;space&quot; character. A &quot;TAB&quot; character. A &quot;newline&quot; character we can add by pressing the ENTER/return button on the keyboard.</p>
<p>So even though you typed in two lines of text and you can see those two line in your editor, the browser shows them on one line.</p>
<p>You can now click the right button of your mouse and ask to &quot;View Page Source&quot;. This will open a separate window with the real content
of the file where you can see the two lines.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/tso/2/index.html">examples/tso/2/index.html</a></strong></p>
<pre><code class="language-html">Welcome to the Spaceship Operator!
Following this series of articles you'll learn programming.

</code></pre>
<p><a href="examples/tso/2/index.html">view</a></p>
<h2 class="title is-4">Add first HTML tags</h2>
<p>In order to convince the browser to show the text in two lines we need to start adding real HTML.
HTML has &quot;tags&quot; that look like this:</p>
<pre><code>&lt;br&gt;
</code></pre>
<p>A few letters between two angle-brackets.</p>
<p>Some of the tags stand on their own, like the above <code>br</code>-tag.</p>
<p>Others need to be added in pairs: an opening part and a closing part. For example this:</p>
<pre><code>&lt;div&gt; Some content &lt;/div&gt;
</code></pre>
<p>If there is a closing tag, it is always the same name with a leading slash <code>/</code>.</p>
<p>The opening part of the tags can also have so called &quot;attributes&quot;. In the next example we see an <code>a</code> tag
that has both an opening side and a closing side. It also has an attribute called <code>href</code> with a value
<code>/</code>.</p>
<pre><code>[Code Maven](/)
</code></pre>
<p>There is a whole <a href="https://developer.mozilla.org/en/docs/Web/HTML/Element">reference guide for HTML</a>,
but don't worry you won't need to learn all that. At least not to get started.</p>
<p>Let's see now how can we display those two lines on two separate lines. The <code>br</code> tag tells the browser to insert a line-break.
So if we put it at the end of the first row and reload the file in the browser we'll see the two rows on separate lines.</p>
<p>Source:</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/tso/3/index.html">examples/tso/3/index.html</a></strong></p>
<pre><code class="language-html">Welcome to the Spaceship Operator!&lt;br&gt;
Following this series of articles you'll learn programming.

</code></pre>
<p><a href="examples/tso/3/index.html">view</a></p>
<p>Result in the browser:</p>
<pre><code>Welcome to the Spaceship Operator!
Following this series of articles you'll learn programming.
</code></pre>
<p>As you can see in the browser we don't see the <code>&lt;br&gt;</code> tag, but we see its impact: The two lines are on separate lines.</p>
<p>Before showing another HTML tag you could play try something. What will happen if you put the whole thing on one line. Like this
and then reload the page in the browser?</p>
<pre><code>Welcome to the Spaceship Operator!&lt;br&gt;Following this series of articles you'll learn programming.
</code></pre>
<p>Try it yourself!</p>
<div class="spoiler" text="Click for Explanation">
<p>
It will show as in the previous case. The newline we've just removed did not have any impact earlier. It can be removed.
The `br` is the important. Of course having one really long line in the HTML file is quite hard to edit so I 
don't recommend that practice, but it is good to remember the newlines don't have an impact on how the HTML
file is displayed in the browser.
</p>
</div>
<p>We can now remove the <code>br</code> tag and add an <code>&amp;lt;h1&amp;gt;</code>-pair.
We are supposed to have only a single <code>h1</code> pair in any document. They are expected to enclose the main title of the page.
By default most browsers will show the content of the h1-elements with large letters and will insert a line-break after the closing
tag of the h1-pair.</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/tso/4/index.html">examples/tso/4/index.html</a></strong></p>
<pre><code class="language-html">&lt;h1&gt;Welcome to the Spaceship Operator!&lt;/h1&gt;
Following this series of articles you'll learn programming.

</code></pre>
<p><a href="examples/tso/4/index.html">view</a></p>
<p>It looks like this:</p>
<p><img src="static/img/html_h1.png" alt="" /></p>
<h2 class="title is-4">HTML5 Skeleton</h2>
<p>Before we continue, let's add a few more HTML tags and create a skeleton for an HTML page.
As many other things, HTML also has version and the requirements change from version to version.
This skeleton matches the HTML5 requirements:</p>
<p><strong><a href="https://github.com/szabgab/front.code-maven.com/tree/main/examples/tso/5/index.html">examples/tso/5/index.html</a></strong></p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;meta charset=utf-8&gt;
	&lt;title&gt;Spaceship Operator&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Welcome to the Spaceship Operator!&lt;/h1&gt;
Following this series of articles you'll learn programming.
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p><a href="examples/tso/5/index.html">view</a></p>
<p>You won't see any difference how this and the preious version looks in the browser.
The whole page is wrapped in <code>html</code> tags and it has two parts. <code>head</code> and <code>body</code>.
The <code>head</code> is traditionally used load other files such as CSS and JavaScript files, but
we don't really have to put those entries in the head any more. The <code>meta</code> tag still needs to go there,
as well as the <code>title</code> which will set what is shown on the &quot;tab&quot;, on the border of the window holding the browser.</p>
<p>The code we had in the previous example goes into the <code>body</code>.</p>
<p>Now you can visit the <a href="https://developer.mozilla.org/en/docs/Web/HTML/Element">HTML reference guide</a> and try playing with
the various HTML elements.</p>
]]></content>
    <author>
      <name></name>
    </author>
  </entry>

</feed>

