<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>InsertHTML</title>
	<atom:link href="https://www.html5canvastutorials.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.html5canvastutorials.com/blog</link>
	<description>Web Design and Development Blog</description>
	<lastBuildDate>Tue, 06 Oct 2020 06:50:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.7</generator>
	<item>
		<title>How To Add Hyperlinks In HTML</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-hyperlinks-in-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-hyperlinks-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Sun, 13 Sep 2020 08:30:45 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6162</guid>

					<description><![CDATA[Hyperlinks are used to navigate between webpages. The hyperlinking of documents creates the web of texts which is the foundation of WorldWideWeb. The hyperlinks create a never-ending set of documents. We all know that Berners-Lee was the person who had the vision of creating a web of pages. SpringerLink discusses the importance of hyperlinks while mentioning how such a web&#8230;]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter size-large"><img width="335" height="243" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/link-building-concept_23-2148009603-1.jpg" alt="How To Add Hyperlinks In HTML" class="wp-image-6166" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/link-building-concept_23-2148009603-1.jpg 335w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/link-building-concept_23-2148009603-1-300x218.jpg 300w" sizes="(max-width: 335px) 100vw, 335px" /></figure></div>



<p></p>



<p>Hyperlinks are used to navigate between webpages. The hyperlinking of documents creates the web of texts which is the foundation of WorldWideWeb. The hyperlinks create a never-ending set of documents.</p>



<p>We all know that <a href="https://www.w3.org/People/Berners-Lee/">Berners-Lee</a> was the person who had the vision of creating a web of pages. <a href="https://link.springer.com/chapter/10.1007/978-3-211-93971-0_26#:~:text=Hyperlinks%20are%20the%20essence%20of,sites%20by%20modern%20search%20engines.">SpringerLink</a> discusses the importance of hyperlinks while mentioning how such a web is more user-friendly than a hierarchical system. It provides a pool of information to the user with such easy navigation.</p>



<p>We can add hyperlinks to text, image, book-marks, tables, e-mail addresses, phones, etc. In this blog, we shall learn why and how, using example code.</p>



<h3>Text Hyperlink</h3>



<p>We use the &lt;a&gt; tag to indicate the start of the hyperlink and the text is between the opening and closing tags of &lt;a&gt;. The ‘href’ attribute is to indicate the location of the hyperlink. It is the URL.</p>



<p>The alternative name for the hyperlink is the anchor as it connects with the target document. The text between &lt;a&gt; tags is known as “hypertext”. Hypertext is displayed by the browser and it links to the URL written in &lt;a&gt; tag.</p>



<pre class="wp-block-code"><code>&lt;a href=  “http://www.html5canvastutorials.com/blog”&gt; Hypertext goes here &lt;/a&gt;</code></pre>



<p>The snippet above makes it clear where the hypertext is written. We generally place such snippets in the text between &lt;p&gt; tag. Let’s check with a code:</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;
      How to add hyperlinks in HTML
    &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;center&gt;
      &lt;p style= "font-size:32px;"&gt;
       HTML stands for HyperText Markup Language. &lt;br&gt; 
       &lt;a href="http://www.html5canvastutorials.com/blog/2020/09/what-is-html/"&gt; 
       What is HTML? 
       &lt;/a&gt; &lt;br&gt; 
        Try clicking on the text above.
        Here Hypertext is "What is HTML?"
        &lt;/p&gt;
    &lt;/center&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Here&#8217;s how the output will look like:</p>



<figure class="wp-block-image size-large"><img width="1024" height="261" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/TextHyper-1024x261.png" alt="How To Add Hyperlinks In HTML" class="wp-image-6164" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/TextHyper-1024x261.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/TextHyper-300x76.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/TextHyper-768x196.png 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/TextHyper.png 1440w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3>Image Hyperlink</h3>



<p>Images are the heart of modern webpages, it gives life to the page. We already know, how to add an image in HTML. We will use the &lt;img&gt; tag in place of hypertext and link the click to a new website or intra-web. So &lt;img&gt; tag will be nested in &lt;a&gt; tag.</p>



<p>We can also create an image map, which allows hyperlinks to multiple websites or webpages by clicking on different regions on the map. This is achieved by using <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-add-css-to-html/">CSS.</a> For the discussion in this article, we shall limit ourselves to learning hyperlinking the image as a whole. </p>



<p>Let’s see the code:</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;
      How to add hyperlinks in HTML
    &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt; Click on the image &lt;/h1&gt;
    &lt;center&gt;
      &lt;p style= "font-size:32px;"&gt;
       Image as a hyperlink &lt;br&gt;
       &lt;a href="http://www.html5canvastutorials.com/blog"&gt;
      &lt;img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg" alt="How to add hyperlink to HTML"&gt; 
        &lt;/a&gt;
         &lt;/p&gt;
    &lt;/center&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Here&#8217;s the output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="498" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/ImageLink.png" alt="How To Add Hyperlinks In HTML" class="wp-image-6165" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/ImageLink.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/ImageLink-300x104.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/ImageLink-1024x354.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/ImageLink-768x266.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>Why Hyperlink?</h3>



<p>Hyperlinks on our website add credibility to the content written, researched, or referred. It has the potential to increase the page views by backlinking or interlinking. The browsers use the Search Engine Optimization technique to show a list of websites that match the user&#8217;s search. To have a place at the top in this list we need to improve our SEO results and hyperlinks do it.</p>



<p>Hyperlinks can be used as ‘in-text’ headings. It can be used for ‘back to top’, ‘next’, ‘previous’, ‘return to homepage’, etc. These are the ways of intra-page and intra-website navigation which gives a great User Experience(UX).</p>



<h3>Conclusion</h3>



<p>As we saw in this tutorial, hyperlinks are an integral part of the World Wide Web. They can be used to improve User Experience (UX), navigation, linking relevant pages, SEO &amp; more.</p>



<p>Thus, it becomes inevitable for any web developer to learn this feature. Hyperlinking can be done in many other ways which can be learned once you have reached the intermediate level. For now, we saw how to add links to text as well as images. You can explore your own codes at <a href="https://codepen.io/">Codepen</a>.</p>



<p>To learn some other <a href="http://www.html5canvastutorials.com/blog/2020/09/what-are-basic-html-tags/">basic HTML tags</a>, view our previous blog! To keep enjoying our tutorials, subscribe to the <a href="http://www.html5canvastutorials.com/blog/">blog</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-hyperlinks-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Change Fonts In HTML</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/how-to-change-fonts-in-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/how-to-change-fonts-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Sat, 05 Sep 2020 06:55:15 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6145</guid>

					<description><![CDATA[Fonts are an important element of any website. They can be used to give different headings or different styles to any text. For example, Headers h1 to h6 all have font sizes in decreasing order and a hyperlink is always highlighted with a different color. “A Good Typography System Will Drive Consistency Between Pages”, says Market8. Earlier in HTML4, we&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="1024" height="683" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3389876-1024x683.jpg" alt="How To Change Fonts In HTML" class="wp-image-6146" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3389876-1024x683.jpg 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3389876-300x200.jpg 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3389876-768x512.jpg 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3389876-1536x1024.jpg 1536w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3389876-2048x1365.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>Fonts are an important element of any website. They can be used to give different headings or different styles to any text. For example, Headers h1 to h6 all have font sizes in decreasing order and a hyperlink is always highlighted with a different color.</p>



<p>“A Good Typography System Will Drive Consistency Between Pages”,
says <a href="https://www.market8.net/b2b-web-design-and-inbound-marketing-blog/4-reasons-why-web-design-fonts-are-more-important-than-website-graphics#:~:text=Web%20fonts%20can%20help%20you,most%20attractive%2C%20and%20so%20on.&amp;text=Using%20a%20contrasting%20color%20can,your%20viewer's%20attention%20to%20it.">Market8</a>.</p>



<p>Earlier in HTML4, we had a &lt;font&gt; tag which is no longer supported by HTML5.  In HTML5 we use style attribute for tags like &lt;p&gt;, &lt;div&gt; and many more. We use font-family, font-style, font-size, and color to get the desired change in the text.</p>



<p>For example, </p>



<pre class="wp-block-code"><code>&lt;p style= “font-family:add_font; font-size:add_size; color:add_color; font-style:add_style;” ></code></pre>



<p>The snippet above shows how to use style attributes along with the desired changes. Every property is followed by “:” (colon) and then specific need. To differentiate between properties we shall use “;” (semi-colon).</p>



<p>We will see all the properties used in the following code:</p>



<pre class="wp-block-code"><code>&lt;html>
   &lt;head>
      &lt;title> Font change in HTML &lt;/title>
   &lt;/head>

   &lt;body>
      &lt;h1> How to change font in HTML &lt;/h1>
      &lt;p style = "font-family:courier; font-size:40px; font-style:oblique; 
         color:blue">
         I am blue with size 40px and my font belong to courier family.
      &lt;/p>
   &lt;/body>

&lt;/html></code></pre>



<p>Here&#8217;s how the output will be:</p>



<figure class="wp-block-image size-full"><img width="1440" height="380" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/ChangeFont.png" alt="How To Change Fonts In HTML" class="wp-image-6147" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/ChangeFont.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/ChangeFont-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/ChangeFont-1024x270.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/ChangeFont-768x203.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<p>In the example above we have used font-family courier. The commonly used are Arial, serif, cursive, times &amp; monospace. Font-size is 40px which has been specifically used to show how to get bigger font than &lt;h1&gt; tag. We can change it as required.</p>



<p>Font-style used is oblique. Most common are bold, underline &amp; italic. The color property in HTML5 has got the liberty to get it without a specific code with just the text of the color. We have used blue. But, you can choose from any known list. Know more about HTML fonts <a href="https://www.w3.org/TR/CSS2/fonts.html">here</a>.</p>



<h3>How To Indent In HTML</h3>



<p>Arranging the alignment of the text makes it visually appealing and conveys the information in a form that is easily understood. We do this using JavaScript and CSS. &lt;script&gt; tag is used to write a function in JavaScript and &lt;style&gt; to write a CSS code. We will see both the ways in detail with an example.</p>



<p><strong>Using &lt;script&gt; Tag</strong></p>



<p>We shall use .textindent property after calling the id of a tag whose text we wish to indent. The number of pixels can be specified after the property as seen in the example below. This property takes over the command of HTML and modifies it using JavaScript. You can <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-add-javascript-to-html/">learn more</a> about it here.</p>



<pre class="wp-block-code"><code>&lt;html>
  &lt;body>

    &lt;div id="check">
       &lt;h1>
       How to indent in HTML. This text has been indented using script tag, 
       which calls the id and adds style to it.
       &lt;/h1>
   &lt;/div>
   &lt;p style="font-size:30px; color:green;"> I ain't indented &lt;/p>
   &lt;script>
      {
      document.getElementById("check").style.textIndent = "200px";
      }
   &lt;/script>
  &lt;/body>
&lt;/html></code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="375" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentScript.png" alt="How To Change Fonts In HTML" class="wp-image-6148" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentScript.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentScript-300x78.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentScript-1024x267.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentScript-768x200.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<p><strong>Using &lt;style&gt; Tag</strong></p>



<p>Indenting text using &lt;style&gt; is achieved by defining a CSS code and using the property “text-indent”. The property values can be length, %, initial, or inherit. We have used length and % in the following code. You can try the other ones <a href="https://www.market8.net/b2b-web-design-and-inbound-marketing-blog/4-reasons-why-web-design-fonts-are-more-important-than-website-graphics#:~:text=Web%20fonts%20can%20help%20you,most%20attractive%2C%20and%20so%20on.&amp;text=Using%20a%20contrasting%20color%20can,your%20viewer's%20attention%20to%20it.">here</a>.</p>



<pre class="wp-block-code"><code>&lt;html>
  &lt;head>
    &lt;style>
      .a {
      text-indent: 100px;
      }

     .b {
     text-indent: 20em;
     }

     .c {
     text-indent: 50%;
     }
   &lt;/style>
  &lt;/head>
  
  &lt;body>

    &lt;h1> How to indent text in HTML &lt;/h1>
    &lt;h2> Report on COVID19 &lt;/h2>

    &lt;div class="a" style="font-family:courier;">
    &lt;p> In France, the first case was reported on January 25; five weeks 
    later, the number rose to 57, but in the sixth week, there were 613 
    cases, which went up to 3,640 and 4,469 in the next two weeks.&lt;/p>
    &lt;/div>

    &lt;div class="b" style="color:red;">
    &lt;p> Similarly, in Italy, till the third week after the first confirmed 
    case, the number was only 3. The cases then shot up to 650, 3,858, 
    15,113 in the subsequent weeks.&lt;/p>
    &lt;/div>

    &lt;div class="c">
    &lt;p> Iran appears to be an exception as the cases increased several times 
    each week. Various newspapers have criticised Iranian authorities for 
    being dismissive of the virus in the initial days of the outbreak. &lt;/p>
    &lt;/div>

   &lt;/body>
&lt;/html></code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="432" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentStyle.png" alt="How To Change Fonts In HTML" class="wp-image-6149" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentStyle.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentStyle-300x90.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentStyle-1024x307.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IndentStyle-768x230.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>Conclusion</h3>



<p>In this tutorial, we learned how to change fonts in HTML. This includes changing the size, font family, and color of any text. Using <a href="http://www.cssnewbie.com/">CSS</a>, you can add many more styles to your webpages.</p>



<p>To learn how to add a table in HTML, see our previous blog(internal link to how to add table)!</p>



<p>To keep reading such useful techniques in HTML, subscribe to our <a href="http://www.html5canvastutorials.com/blog/">blog</a>! </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/how-to-change-fonts-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What Are Basic HTML Tags</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/what-are-basic-html-tags/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/what-are-basic-html-tags/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Sat, 05 Sep 2020 06:46:01 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6158</guid>

					<description><![CDATA[HTML is a dynamic programming language &#38; the simplest to learn because of the tags. Tags in HTML define what we expect from the modern webpages. Here we shall see all those tags which can help you create, probably your first webpage. The &#60;html&#62; Tag This is the most basic tag which will be seen in every HTML text. &#60;html&#62;&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="1024" height="1024" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318-1024x1024.jpg" alt="What Are Basic HTML Tags" class="wp-image-6159" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318-1024x1024.jpg 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318-300x300.jpg 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318-150x150.jpg 150w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318-768x768.jpg 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318-1536x1536.jpg 1536w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318-120x120.jpg 120w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/3911318.jpg 2000w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>HTML is a dynamic programming language &amp; the simplest to learn because of the tags. Tags in HTML define what we expect from the modern webpages. Here we shall see all those tags which can help you create, probably your first webpage.</p>



<h3>The &lt;html&gt; Tag</h3>



<p>This is the most basic tag which will be seen in every HTML text. &lt;html&gt; tag defines that the document is in HTML, it is considered the root of the language. All other tags are always nested inside the opening(&lt;html&gt;) and closing tags(&lt;/html&gt;).</p>



<h3>The &lt;head&gt; Tag</h3>



<p>We generally divide the content inside the &lt;html&gt; tag into two, of which the first is &lt;head&gt;. It contains the metadata for the document. The style, script, links, character set of the document are written inside the &lt;head&gt; tag.</p>



<h3>The &lt;title&gt; Tag</h3>



<p>The title of the document goes between opening and closing tags of title. It is commonly nested inside the &lt;head&gt; tag. It is not displayed on the webpage but on the browser’s title bar. You must keep the content in it relevant to the article and succinct.</p>



<h3>The &lt;body&gt; Tag</h3>



<p>The second half of the &lt;html&gt; tag is a body tag. Almost all tags will be nested inside the &lt;body&gt; tag. The main content of the webpage is defined here including tables, text, hyperlinks, or images.</p>



<h3>The Heading Tags (&lt;h1&gt; to &lt;h6&gt;)</h3>



<p> These tags define HTML headings with variation in the font-size. The font-size decreases from h1 to h6 with sizes 32px to 10.72px. We shall see a code along with the usage of the previous tags to learn better.</p>



<pre class="wp-block-code"><code>&lt;html>

   &lt;head>
      &lt;title> Basic tags in HTML &lt;/title>
   &lt;/head>
	
   &lt;body>
      &lt;h1> I am heading 1 &lt;/h1>
      &lt;h2> I am heading 2 &lt;/h2>
      &lt;h3> I am heading 3 &lt;/h3>
      &lt;h4> I am heading 4 &lt;/h4>
      &lt;h5> I am heading 5 &lt;/h5>
      &lt;h6> I am heading 6 &lt;/h6>
   &lt;/body>
	
&lt;/html></code></pre>



<p>Here&#8217;s how the output will be:</p>



<figure class="wp-block-image size-full"><img width="1440" height="376" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Iamhead.png" alt="What Are Basic HTML Tags" class="wp-image-6160" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Iamhead.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Iamhead-300x78.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Iamhead-1024x267.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Iamhead-768x201.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>The &lt;p&gt; Tag</h3>



<p>&lt;p&gt; tag specifies the beginning of a paragraph and hence starts with a new line and leaves a line after the closing tag. It is a block-level element that separates the content on the webpage. The spaces and line breaks written inside the &lt;p&gt; tag are ignored by the browsers. We use the &lt;br&gt; tag for a single line break and it’s an empty tag. It can be used without a closing tag.</p>



<pre class="wp-block-code"><code>&lt;html>

  &lt;head>
    &lt;title> Basic HTML tags &lt;/title>
  &lt;/head>

&lt;body>

&lt;p>
My line 
breaks are 
ignored by
the browser.
&lt;/p>

&lt;p>
Even  the  spaces are   
  ignored as   browser   treats  this   as   a paragraph
&lt;/p>

&lt;!-- I am a comment and will be ignored completely in the output -->

&lt;p>
The br tag &lt;br>
  instructs the browser &lt;br>
  to start from a &lt;br>
  fresh line. &lt;br> 
  &lt;hr>
  A tag embraced by the poets is br tag
&lt;/p>

  
&lt;/body>
&lt;/html></code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="379" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Paragraph.png" alt="What Are Basic HTML Tags" class="wp-image-6161" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Paragraph.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Paragraph-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Paragraph-1024x270.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/09/Paragraph-768x202.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>The &lt;hr&gt; Tag</h3>



<p>We saw the use of &lt;hr&gt; tag in the previous code and as the output suggests it is a horizontal rule which indicates a thematic change in the content. It is an empty element and does not need an ending tag.</p>



<h3>The Comment Tag</h3>



<p> Comments in the code can be indicated with the text in between the tag &lt;!&#8211;&#8230;&#8211;&gt;. The start of a tag &lt;!&#8211; instructs the browser not to display the content written till &#8211;&gt;. It is useful for the coding community and for the coder himself to refer at a later point of time.</p>



<p>An example of it is used in the above code and it is not displayed in the output. Learn more about the <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-comment-in-html/">comment tag</a> here.</p>



<h3>The &lt;img&gt; Tag</h3>



<p>One may debate about &lt;img&gt; tag being a basic tag. But it is an essential part of modern webpages. The webpage looks dull and dead without a live image and to add it in an HTML file we use the &lt;img&gt; tag. It is a self-containing tag that uses the attribute src and alt. ‘src’ is to find the source of the image &amp; ‘alt’ is to provide an alternate text to the image for search engines. Know more on <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-center-an-image-in-html/">&lt;img&gt; tag</a> in our blog.</p>



<h3>Conclusion</h3>



<p>The tags discussed here are sufficient to create your first webpage and I would encourage you to make one. You can code and run it on <a href="https://codepen.io/">Codepen</a>. </p>



<p>HTML tags are often complemented by <a href="https://www.w3schools.com/html/html_attributes.asp">HTML attributes</a>. There can be other tags that may be said as basic tags but we are good to start with all these tags.</p>



<p>Learn more HTML tags and features in our <a href="http://www.html5canvastutorials.com/blog/">blog</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/what-are-basic-html-tags/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Add CSS To HTML</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-css-to-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-css-to-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Tue, 01 Sep 2020 07:09:42 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6131</guid>

					<description><![CDATA[The trinity of HTML, CSS, and JavaScript is inseparable for modern webpages. HTML contains the content, CSS adds styling and JavaScript makes it dynamic. Here, we will learn how to add CSS to HTML. But before that, let’s see a brief introduction to “What is CSS”. CSS is Cascading Style Sheets which provides the visual appearance of the content in&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="1024" height="627" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/2824236-1024x627.jpg" alt="How To Add CSS To HTML" class="wp-image-6132" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/2824236-1024x627.jpg 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/2824236-300x184.jpg 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/2824236-768x471.jpg 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/2824236-1536x941.jpg 1536w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/2824236-2048x1255.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>The trinity of HTML, CSS, and <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-add-javascript-to-html/">JavaScript</a> is inseparable for modern webpages. HTML contains the content, CSS adds styling and JavaScript makes it dynamic. Here, we will learn how to add CSS to HTML.</p>



<p>But before that, let’s see a brief introduction to “What is CSS”. CSS is <a href="https://www.w3schools.com/css/default.asp">Cascading Style Sheets</a> which provides the visual appearance of the content in HTML. Earlier there was no CSS, so the control of the page was with the tags such as &lt;font&gt;, &lt;b&gt;, &lt;i&gt;, etc. This led to several problems while styling the entire content. The changes had to be made to every individual tag. To our rescue, we have CSS now. The CSS specifications are maintained by the&nbsp;<a href="https://www.w3.org/">World Wide Web Consortium</a>&nbsp;(W3C).</p>



<p>To add CSS, we have two ways. First to add it directly in the HTML code using &lt;style&gt; tag and second, writing the code separately and then linking it to the HTML code using &lt;link&gt; tag.</p>



<h3>The &lt;style&gt; Tag </h3>



<p>It is simple and easy to start with &amp; add the
code directly in the HTML. The &lt;style&gt; tag can be placed anywhere in the
code, though the common practice is to place it in &lt;head&gt; tag.</p>



<p>It can also be used as an attribute inside &lt;body&gt;,
&lt;head&gt;, &lt;div&gt;, or in other tags to get the desired styling.</p>



<p>Below is an example that uses CSS in &lt;style&gt; tag:</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt; How to add CSS to HTML using Style tag &lt;/title&gt;
    &lt;style&gt;
      #addCSS{
        color:blue;
        font-size:90px;
      }
    &lt;/style&gt;
    
    &lt;h1 id="addCSS"&gt; The style added above applies on me. &lt;/h1&gt; 
  &lt;/head&gt;
  &lt;body&gt;
    I am not affected by style
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Here&#8217;s what the output will be for the above code:</p>



<figure class="wp-block-image size-full"><img width="1440" height="374" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-tag.png" alt="How To Add CSS To HTML" class="wp-image-6133" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-tag.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-tag-300x78.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-tag-1024x266.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-tag-768x199.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<p>The below illustration shows us how using style as an attribute can also add CSS to HTML:</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt; How to add CSS to HTML using Style tag &lt;/title&gt;  
    &lt;h1 style="font-family:courier;"&gt; I have the font as given by the style 
     attribute &lt;/h1&gt; 
  &lt;/head&gt;
  &lt;div style="font-size:400%"&gt;
    I got enlarged because of CSS
  &lt;/div&gt;
&lt;/html&gt;</code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="380" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-Attribute.png" alt="How To Add CSS To HTML" class="wp-image-6134" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-Attribute.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-Attribute-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-Attribute-1024x270.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Style-Attribute-768x203.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>HTML Button</h3>



<p>Buttons come in different shapes, sizes, and styles. We can have multiple types of buttons like the shadow button, hover-able button, colored button, round button, buttons in groups, and many more. &lt;button&gt; and &lt;style&gt; tag are the key to unlock the variety of buttons. The &lt;button&gt; tag uses multiple <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes">global and local attributes</a> to support different buttons.</p>



<p>We will use CSS inside the &lt;style&gt; tag and call the function in the &lt;button&gt; tag. We have also used properties like <em>border, paddling, color, text-align, background, &amp; display. </em>These properties help us create a colored button. We can also add text on a button. The text which we want to display on the button has to be written after the opening &lt;button&gt; tag.</p>



<p>Here’s the code:</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
      .button {
      border: none;
      color: white;
      padding: 15px 60px;
      text-align: center;
      display: inline-block;
      font-size: 24px;
      align: center;
      }

    .button1 {
      background-color: green; 
      color: black; 
      border: 2px solid black;
     }
    &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;h2 align="center"&gt; How to add button in HTML &lt;/h2&gt;
    &lt;center&gt;
      &lt;button class="button button1"&gt; I am what i am, thanks to button and 
      style tag&lt;/button&gt;
    &lt;/center&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Output:</p>



<figure class="wp-block-image size-large"><img width="1024" height="270" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/HTML-Button-1024x270.png" alt="How To Add CSS To HTML" class="wp-image-6135" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/HTML-Button-1024x270.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/HTML-Button-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/HTML-Button-768x203.png 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/HTML-Button.png 1440w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p><strong>HTML Checkbox</strong></p>



<p>Well, checkbox doesn’t have its own tag like button. We will use the &lt;input/&gt; tag which itself is a starting and ending tag. The ‘type’ attribute is used to add the checkbox and &lt;label&gt; tag to get the label before the checkbox.</p>



<p>Here’s how you can do it:</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE HTML&gt;
&lt;html lang = "en"&gt;
  
  &lt;head&gt; &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt; How to add checkbox in HTML &lt;/h1&gt;
    &lt;form&gt;
       &lt;fieldset style="background-color:blue;"&gt;
        
         &lt;p&gt; &lt;center&gt;
           &lt;label&gt; Check the websites that you have visited &lt;/label&gt; &lt;br&gt;
             &lt;input type = "checkbox"
                 id = "inserthtml" /&gt;
             &lt;label for = "inserthtml"&gt; cssnewbies.com &lt;/label&gt;
             &lt;input type = "checkbox"
                 id = "tom" /&gt;
             &lt;label for = "tom"&gt; jqueryhouse.com &lt;/label&gt;
         &lt;/p&gt;
       &lt;/fieldset&gt;
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="378" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Checkbox.png" alt="How To Add CSS To HTML" class="wp-image-6136" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Checkbox.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Checkbox-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Checkbox-1024x269.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Checkbox-768x202.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>Conclusion</h3>



<p>In this tutorial, we saw what is CSS and how it is used to style webpages. You can learn more about CSS at <a href="http://cssnewbie.com/">CSSNewbie</a>! To keep enjoying such tutorials on HTML, subscribe to our <a href="http://www.html5canvastutorials.com/blog">blog</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-css-to-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What Is div In HTML?</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/what-is-div-in-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/what-is-div-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Tue, 01 Sep 2020 07:09:16 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6120</guid>

					<description><![CDATA[div short for Division in HTML divides the webpage into blocks of content or sets the layout. It has both the opening and the closing tag. &#60;div&#62; tag serves multiple purpose in HTML. It has several properties like setting the web-layout, as a block-level element, getting the headings, paragraphs, and forms. “The Div is the most usable tag in web&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="1024" height="683" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/4049330-1024x683.jpg" alt="What Is div In HTML?" class="wp-image-6121" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/4049330-1024x683.jpg 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/4049330-300x200.jpg 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/4049330-768x512.jpg 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/4049330-1536x1024.jpg 1536w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/4049330-2048x1365.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>div short for Division in HTML divides the webpage into blocks of content or sets the layout. It has both the opening and the closing tag. &lt;div&gt; tag serves multiple purpose in HTML. It has several properties like setting the web-layout, as a block-level element, getting the headings, paragraphs, and forms.</p>



<p>“The Div is the most usable tag in web development because it helps us to separate out data in the web page and we can create a particular section for particular data or functionality in the web pages.”, says <a href="https://www.geeksforgeeks.org/div-tag-html/#:~:text=The%20Div%20is%20the%20most,function%20in%20the%20web%20pages.&amp;text=It%20is%20used%20to%20the,can%20be%20applied%20to%20them.">GeeksForGeeks</a>.</p>



<p>In this tutorial, we will see what is div in HTML.</p>



<h3>div Using Class</h3>



<p>We can use class by internal CSS or external CSS. We will see both ways.</p>



<p><strong>Internal CSS</strong></p>



<p>We will use &lt;style&gt; tag to define the class in the &lt;head&gt; section. And while using &lt;div&gt; tag we shall call the class that is previously defined. Check the example below:</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
      .check {
      border: 8px outset blue;
      background-color: gray; 
      text-align: center;
      }
    &lt;/style&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;div class="check"&gt;
    &lt;h2&gt; What is div in HTML &lt;/h2&gt;
    &lt;p&gt; This is one of the many important usages of div tag &lt;/p&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Here&#8217;s how the output will look like:</p>



<figure class="wp-block-image size-full"><img width="1440" height="378" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Internal-CSS.png" alt="What Is div In HTML?" class="wp-image-6122" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Internal-CSS.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Internal-CSS-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Internal-CSS-1024x269.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Internal-CSS-768x202.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<p><strong>External CSS</strong></p>



<p>We will use both the panes of HTML and CSS for the &lt;div&gt; tag. Try <a href="https://codepen.io/">CodePen</a> to access both the panes together. We shall use a link tag to connect the two codes and name .css file for the href attribute.</p>



<p>Here we have used inserthtml.css which implies the file in CSS will be .inserthtml and the class attribute to be used in &lt;div&gt; tag shall also be defined as inserthtml. Check the below code for more clarity.</p>



<pre class="wp-block-code"><code>&lt;html&gt; 
   &lt;head&gt; 
      &lt;link rel="stylesheet" href="inserthtml.css"&gt; 
      &lt;title&gt; 
         Uses of div in HTML
      &lt;/title&gt; 
   &lt;/head&gt; 
   &lt;body&gt; 
      &lt;center&gt; 
         &lt;div class="inserthtml"&gt;
               &lt;h1&gt; What is div in HTML &lt;/h1&gt; 
          &lt;p&gt; This is external CSS.
          &lt;/p&gt; 
         &lt;/div&gt;
      &lt;/center&gt; 
   &lt;/body&gt; 
&lt;/html&gt;
</code></pre>



<p>Now, the CSS code will be as follows:</p>



<pre class="wp-block-code"><code>.inserthtml
{ 
height:150px; 
width:500px; 
 background-color: blue; 
}</code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="378" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/External-CSS.png" alt="What Is div In HTML?" class="wp-image-6123" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/External-CSS.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/External-CSS-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/External-CSS-1024x269.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/External-CSS-768x202.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>div As A Web Layout</h3>



<p>The layout of a webpage can also be set by using the &lt;div&gt; tag. Here we will use the Internal CSS in &lt;div&gt; as seen earlier.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;head&gt;
   
    &lt;style&gt;
      .divascontainer {
        display: flex;
        align-items: center;
        width: 100%;
        height: 350px;
        background-color: red;
      }
.divascontainer &gt; div
      {
        width: 25%;
        height: 100px;
        margin: 150px;
        
       background-color: green;
      }
      
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div class="divascontainer"&gt;
      &lt;div&gt; &lt;left&gt; Hello &lt;/left&gt; &lt;/div&gt;
      &lt;div&gt; &lt;center&gt; HTML &lt;/center&gt; &lt;/div&gt;
     
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="370" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/DIV-as-Weblayout.png" alt="What Is div In HTML?" class="wp-image-6124" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/DIV-as-Weblayout.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/DIV-as-Weblayout-300x77.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/DIV-as-Weblayout-1024x263.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/DIV-as-Weblayout-768x197.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<p>Multiple layouts can be prepared to alter the above code. The best way shall be to design a UI and then implement it in HTML. I’m sure you will explore it more and it will keep you interested.</p>



<h3>div As A Block</h3>



<p>Sometimes we want to have a specific font, background, or color for a particular block of the webpage. This can be achieved by using &lt;div&gt;. In the following example, we will have three sections of the page.</p>



<p>First one without a &lt;div&gt; tag. The second section with &lt;div&gt; has a background image and it contains only the portion till this &lt;div&gt; tag ends. The background expands and contracts based on the content this section needs to display. The third and last section of this example has a blue color background and this, again, will only be for the text written till the closing tag.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;body&gt;
    &lt;h1&gt;Checking different usage of div tag in HTML&lt;/h1&gt;
    &lt;p&gt;This section has no styling and is not a part of div tag.&lt;/p&gt;
    &lt;div style="background-image: 
     url('https://cdn.pixabay.com/photo/2015/04/23/22/00/tree- 
     736885__340.jpg')"&gt;
     &lt;p&gt;
       &lt;center style="color:white"&gt;
       Check &lt;br&gt;for &lt;br&gt;the &lt;br&gt;image &lt;br&gt;Is&lt;br&gt; it &lt;br&gt;a &lt;br&gt;big &lt;br&gt;one?
       &lt;/center&gt;
     &lt;/p&gt;
    &lt;/div&gt; 
    &lt;div style="background-color:DodgerBlue;"&gt; What is div in HTML.&lt;br&gt; The 
     background of only this section is blue.&lt;br&gt; This is how we can 
     separate the section of a webpage using div tag
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="377" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Div-as-block.png" alt="What Is div In HTML?" class="wp-image-6125" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Div-as-block.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Div-as-block-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Div-as-block-1024x268.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Div-as-block-768x201.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>Conclusion</h3>



<p>In this tutorial, we saw multiple ways of using the &lt;div&gt; tag. Such styling tags are essential to building an interactive and responsive webpage. You can learn more about the <a href="https://www.w3docs.com/learn-html/html-div-tag.html">attributes and styling of the &lt;div&gt; tag</a> here!</p>



<p>To learn <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-center-text-in-html/">how to center text</a> and <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-center-an-image-in-html/">image</a> in HTML click here! You can learn more such useful techniques on our <a href="http://www.html5canvastutorials.com/blog">blog</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/what-is-div-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Add Javascript To HTML</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-javascript-to-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-javascript-to-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Tue, 01 Sep 2020 07:09:11 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6126</guid>

					<description><![CDATA[HTML5, CSS and JavaScript are the inseparable trinity of modern webpages. HTML lets us add content to the webpage, CSS helps with styling and layout, and JavaScript adds the interactivity in the page. We will learn briefly about the JavaScript and then how to link JavaScript to HTML. What Is JavaScript? JavaScript is a text-based scripting and dynamic programming language&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="1024" height="683" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3099563-1024x683.jpg" alt="How To Add Javascript To HTML" class="wp-image-6127" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3099563-1024x683.jpg 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3099563-300x200.jpg 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3099563-768x512.jpg 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3099563-1536x1024.jpg 1536w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/3099563-2048x1365.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<p>HTML5, CSS and JavaScript are the inseparable trinity of modern webpages. HTML lets us add content to the webpage, CSS helps with styling and layout, and JavaScript adds the interactivity in the page.</p>



<p>We will learn briefly about the JavaScript and then how to link JavaScript to HTML.</p>



<h3><strong>What Is JavaScript?</strong></h3>



<p>JavaScript is a text-based scripting and dynamic programming language widely used by developers. It was founded more than two decades ago but is still the most commonly used language and hence is recognized by every modern browser which has an in-built engine.</p>



<p>It basically adds the dynamic feature of a website and turns it live. It can be used for: </p>



<ul><li><strong>Automation: </strong>The refreshing we see on Facebook, Twitter or any social media site</li><li><strong>Game Development: </strong>Most basic and infant programmers should always start by building a simple game using JavaScript, as this can directly be played in the browser</li><li><strong>Developing Web and Mobile Applications: </strong>Most modern mobile applications can be developed using JavaScript.</li><li><strong>Front-End and Back-End Development: </strong>Front-End uses of JavaScript can be well understood. The Back-End work of creating a server and linking with the databases can also be achieved easily using frameworks like Node.js </li></ul>



<h3>JavaScript&nbsp;HTML DOM</h3>



<p>Document Object Model is created by the browser when the webpage is downloaded. JavaScript can modify all HTML elements, attributes, CSS styling, create new events, elements, add attributes, and many more. This makes JavaScript the commanding officer of the HTML.</p>



<p><strong>The &lt;script&gt; Tag</strong></p>



<p>The power to change and make the HTML dynamic using JavaScript is enabled using &lt;script&gt; tag. It can be used to define the function of JavaScript in the same code or by calling a file that contains the Javascript in the same folder, file, or external location.</p>



<p>It uses both the opening and the closing tag. <em>methods</em> and <em>properties</em> also play an important role here. We will further discuss all its usage in detail.</p>



<h3>Adding Javascript To A Code In HTML</h3>



<p>Now, let’s check the example and learn more.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
   &lt;body&gt;
      &lt;h1&gt;How to link JavaScript to HTML&lt;/h1&gt;
      &lt;div id="check"&gt; Whatever we have written here will not be displayed 
      in the output.&lt;/div&gt;

      &lt;script&gt;
           document.getElementById("check").innerHTML ="I am empowered by 
           the script tag to take over the HTML content";
      &lt;/script&gt;
   &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Output:</p>



<figure class="wp-block-image size-full"><img width="1440" height="377" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/js.png" alt="How To Add Javascript To HTML" class="wp-image-6128" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/js.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/js-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/js-1024x268.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/js-768x201.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<p>Here, we have used the method as ‘getElementById()’, property as ‘innerHTML’ and DOM document. The id check of &lt;div&gt; tag is called in by the method inside the &lt;script&gt; tag to change the desired output set in HTML file.</p>



<p>Hence, we see the output written by the property ‘innerHTML’ instead of the one in the &lt;div&gt; tag. This example shows us two things. First, it shows how JavaScript takes over the control, and second, how it can be used to add or delete the content.</p>



<h3>Linking To An External File</h3>



<p>We can write the JavaScript code in a separate file and use the script tag to call the file. We will use type (may not be necessary for all browsers) and src. The type attribute suggests the type of script and the src attribute gives the source for the external file to be used.</p>



<p>This is the generalized example of it.</p>



<pre class="wp-block-code"><code>&lt;script type="text/javascript" src="path-to-javascript-file.js"&gt; &lt;/script&gt;</code></pre>



<p>Specifically for the external file which is not stored in the same folder as the HTML file, we can use the following example:</p>



<pre class="wp-block-code"><code>&lt;script src="[url_of_the_js_library]"&gt; &lt;/script&gt;</code></pre>



<p> Illustration to code when .js file is separate:</p>



<pre class="wp-block-code"><code>&lt;html&gt;
   &lt;head&gt;
      &lt;p&gt; &lt;h1&gt; How to link JavaScript in HTML &lt;br&gt; &lt;/h1&gt; &lt;/p&gt;
      &lt;script src = "/html/script.js" type = "text/javascript"/&gt; &lt;/script&gt;
   &lt;/head&gt;

   &lt;body&gt;
      &lt;input type = "button" onclick = "President();"  value = "Click Me" 
       style="color:green" /&gt; Click the button to see the dynamic 
       aspect of the page
   &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>The Js file code will be:</p>



<pre class="wp-block-code"><code>function President()
{
   	alert("You have clicked the button and linked the JavaScript");
}</code></pre>



<p> Output:</p>



<p>Before clicking the button:</p>



<figure class="wp-block-image size-full"><img width="1440" height="373" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Before-Click-.png" alt="How To Add Javascript To HTML" class="wp-image-6129" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Before-Click-.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Before-Click--300x78.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Before-Click--1024x265.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Before-Click--768x199.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<p>Once you click on the button:</p>



<figure class="wp-block-image size-full"><img width="1440" height="754" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/After-Click.png" alt="How To Add Javascript To HTML" class="wp-image-6130" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/After-Click.png 1440w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/After-Click-300x157.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/After-Click-1024x536.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/After-Click-768x402.png 768w" sizes="(max-width: 1440px) 100vw, 1440px" /></figure>



<h3>JavaScript Frameworks</h3>



<p>Frameworks provide codes that are already written by developers and are available to use for free. Some important and commonly used frameworks which have its library that will help you code easily are:</p>



<ul><li><a href="https://angular.io/">Angular</a></li><li><a href="https://reactjs.org/">React</a></li><li><a rel="noreferrer noopener" href="https://nodejs.org/en/" target="_blank">Node.js</a></li><li><a rel="noreferrer noopener" href="https://vuejs.org/" target="_blank">Vue.js</a></li><li><a href="https://jquery.com/">JQuery</a> </li></ul>



<h3>Conclusion</h3>



<p>In this tutorial, we learned the basics of adding Javascript to HTML. You can <a href="https://www.learningjquery.com/">learn more about Javascript</a> here! You can also <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-add-css-to-html/">add CSS to HTML</a>, to create a comprehensive webpage.</p>



<p>To learn such other HTML features subscribe to our <a href="http://www.html5canvastutorials.com/blog/">blog</a>! </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/how-to-add-javascript-to-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Comment In HTML</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/how-to-comment-in-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/how-to-comment-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Tue, 01 Sep 2020 07:09:07 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6115</guid>

					<description><![CDATA[Writing code isn’t only for the present, it’s an ongoing process. When we code we will need to edit it in the future or collaborate with another coder. That’s where comments come into the picture. It even helps you when you check your work at a later date. Comments are not read by the browser, it solely serves the coding&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="1024" height="739" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/14000-1024x739.jpg" alt="How To Comment In HTML" class="wp-image-6116" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/14000-1024x739.jpg 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/14000-300x217.jpg 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/14000-768x555.jpg 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/14000-1536x1109.jpg 1536w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/14000-2048x1479.jpg 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Customer feedback</figcaption></figure>



<p></p>



<p>Writing code isn’t only for the present, it’s an ongoing process. When we code we will need to edit it in the future or collaborate with another coder. That’s where comments come into the picture. It even helps you when you check your work at a later date. Comments are not read by the browser, it solely serves the coding community.</p>



<p>“Clarification comments are
intended for anyone (including your future self) who may need to maintain,
refactor, or extend your code.”, says <a href="https://www.freecodecamp.org/news/code-comments-the-good-the-bad-and-the-ugly-be9cc65fbf83/">FreeCodeCamp</a>.</p>



<p>Yet it is best advised to <a href="https://medium.com/better-programming/comments-in-your-code-730cfd1dde02">keep comments to a minimum</a>. So, the question remains “how to comment”? Alright, let’s see how to do it.</p>



<p>Whenever we want a note not to be displayed in the output add&nbsp; ‘&lt;!&#8211;‘ &amp; ‘&#8211;&gt;’ in front and end respectively. It’s that simple. Check the code below. You can also try it yourself at <a href="https://codepen.io/pen/">Codepen</a>.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;div&gt;
    &lt;!-- This is to learn how to comment in HTML and this won't be displayed 
         in the output --&gt;
    &lt;p style="text-align:center;"&gt;  I am meant to be displayed  and in 
       center &lt;/p&gt; 
  &lt;/div&gt;
&lt;/html&gt;  </code></pre>



<p>Here&#8217;s the output of the above code:</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img width="1439" height="368" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/How-to-comment.png" alt="How To Comment In HTML" class="wp-image-6117" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/How-to-comment.png 1439w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/How-to-comment-300x77.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/How-to-comment-1024x262.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/How-to-comment-768x196.png 768w" sizes="(max-width: 1439px) 100vw, 1439px" /></figure></div>



<p>Click here to learn about <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-center-text-in-html/">center text</a> &amp; <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-center-an-image-in-html/">center image</a> in HTML.</p>



<p>The comment tag does not support any event or standard attribute. Unlike other tags, the comment tag itself is used to start &amp; end the tag.</p>



<p>There was a &lt;comment&gt; tag which was used in earlier versions but modern browsers do not recognize it. Observe the code below and check its output. See if you can find an error in the code.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;div&gt;
    &lt; !-- This is to learn how to comment in HTML and this won't be 
          displayed in the output -- &gt;
    &lt;p style="text-align:center;"&gt; Only I was meant to be displayed &lt;/p&gt; 
  &lt;/div&gt;
&lt;/html&gt;</code></pre>



<div class="wp-block-image"><figure class="aligncenter size-full"><img width="1438" height="367" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/KK.png" alt="How To Comment In HTML" class="wp-image-6118" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/KK.png 1438w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/KK-300x77.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/KK-1024x261.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/KK-768x196.png 768w" sizes="(max-width: 1438px) 100vw, 1438px" /></figure></div>



<p>I’m sure you would have figured out the error. Yes, it is the space after the opening angular bracket ‘&lt;’. Be mindful of not clicking the extra spacebar there.</p>



<h3>How To Comment Multiple Lines In HTML</h3>



<p>We have seen how to comment in HTML, and now we just need to build on it. Leave a line after the starting of the comment tag ‘&lt;!&#8211;‘ and a line before the end tag ‘&#8211;&gt;’.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;body&gt;
    &lt;!--
       Let’s learn how to comment in HTML.
       Infact How to comment multiple lines in HTML
       This won't be displayed in the output 
     --&gt;
    &lt;p style="text-align:right;"&gt; Even multiple lines will not be displayed 
    &lt;/p&gt; 
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>Now, we can learn how to use these multiple lines comment tags for hiding the code. This can be used when we don’t want the code to get displayed for testing purposes. We can nest multiple tags inside the comment tags. This feature of multiple lines tag helps us keep the redundant or outlived code in the source code without displaying its output.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
  &lt;body&gt;
       &lt;!--
	  &lt;p&gt; We can learn more about HTML here(inserthtml.com)&lt;/p&gt;
	  &lt;img src=”html.png” alt=”How to comment in HTML”&gt;
	  Even a write up without a nesting tag won’t be displayed
       --&gt;
       &lt;p&gt; Everything from here is not inside the comment tag and it will be 
           displayed 
       &lt;/p&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p> You can also try out this code on your own at <a href="https://codepen.io/pen/">Codepen</a>.</p>



<h3>How To Hide Script From Browsers</h3>



<p>Sometimes for unsupported browsers, we need to hide the script. For example, while programming in JavaScript, we can use the comment function to hide the script on browsers that don&#8217;t support it.</p>



<pre class="wp-block-code"><code>&lt;html&gt;
   &lt;head&gt;
      &lt;title&gt;How to hide from unsupported browsers&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
      &lt;script language="javascript" type="text/javascript"&gt;
      &lt;!--
         document.write("Comment in HTML")
      //--&gt;
      &lt;/script&gt;
   &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>As we can see in the code above, insert the comment at the start of the script, and end it with //&#8211;&gt; to ensure that the script works on browsers that do support it.</p>



<h3>Conclusion</h3>



<p>In this tutorial, we learned how to add comments in HTML, how to add multiple lines of comment, and how to hide script that is not supported by the browser. You can learn more such techniques on our <a href="http://www.html5canvastutorials.com/blog/">blog</a> here! </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/how-to-comment-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Center An Image In HTML</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/how-to-center-an-image-in-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/how-to-center-an-image-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Tue, 01 Sep 2020 07:09:04 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6112</guid>

					<description><![CDATA[A picture speaks a thousand words. “Websites that use images well can sell a lifestyle, an ideal, an idea or whatever the product needs to sell more”, says ThoughtMechanics. Thus, while learning web development it is important to learn how to format images. Images are the major ingredient of modern webpages. Without using them the page isn’t eye-catching. Using the&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="862" height="360" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IMAGE-CENTER.png" alt="How To Center An Image In HTML" class="wp-image-6114" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IMAGE-CENTER.png 862w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IMAGE-CENTER-300x125.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/IMAGE-CENTER-768x321.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></figure>



<p></p>



<p>A picture speaks a thousand words. </p>



<p>“Websites that use images well can sell a
lifestyle, an ideal, an idea or whatever the product needs to sell more”, says <a href="http://www.thoughtmechanics.com/the-importance-of-images-in-web-design/#:~:text=An%20image%20can%20also%20communicate,immersive%20experience%20than%20writing%20alone.">ThoughtMechanics</a>. Thus, while learning web development
it is important to learn how to format images.</p>



<p>Images are the major ingredient of modern webpages. Without using them the page isn’t eye-catching. Using the right image to express adds value to the content of the page.</p>



<p>Aesthetic images are used as background images and informative images are used for products or services.</p>



<p>Thus, while learning web development it is important to learn how to format images. In this tutorial, we will learn how to add an image, background image &amp; center-align image. So, before learning how to center an image, we will learn how to add an image.</p>



<h3>How To Add An Image In HTML </h3>



<p>The &lt;img&gt; tag is used to add images to webpages.<br> <br> Here is the most basic &lt;img&gt; tag:</p>



<pre class="wp-block-code"><code> &lt;img src="insertimage.png" alt="How to add an image"/&gt;</code></pre>



<p>Out of the several attributes&nbsp;which are supported by &lt;img&gt; tag, only src and alt are required. The rest are useful but optional attributes.</p>



<p><strong>The &#8216;src&#8217; Attribute</strong></p>



<p>The source attribute tells us where to fetch the image from. There are two different types of URLs you can give for source.<br><br> <strong>1. Path to an image file within your web site:</strong></p>



<pre class="wp-block-code"><code>&lt;img src="inserthtml.png" alt="Center align the image"/&gt;</code></pre>



<p><strong> 2. Path to an image file that is on the web anywhere in the world:</strong></p>



<pre class="wp-block-code"><code>&lt;img src="http://www.example.com/image-with-absolute-url.png" alt="How to add images"/&gt;</code></pre>



<p> The file format preferable for the images depends on the browser and not on the &lt;img&gt; tag, though general types include png, jpg, jpeg, svg, gif and bmp.</p>



<p><strong>The ‘alt’ Attribute</strong></p>



<p>alt represents alternate text for the image. It is useful to provide necessary information to the search engines. Assistive technologies like screen readers can use this to help the listener visualize the text flow.</p>



<p>The alt text will also be displayed on the screen when the browser is unable to load or find the source of the image. It is imperative to use the text which best describes the image. </p>



<pre class="wp-block-code"><code>&lt;img src="image/tulips.png" alt="This is supposed to be an image of tulips"/&gt;</code></pre>



<p><strong>The Height &amp; Width Attribute</strong></p>



<p>The display of our monitors and laptops are made up of millions of pixels. You may not find the image which fits on your web page perfectly. Yes, we can resize it. This gives the liberty to pick any picture and change the pixel size of it.</p>



<p>Let us see how to add the height and width attribute to an image.</p>



<pre class="wp-block-code"><code>&lt;img src="html.png" alt="How to add an image"  height="180" width="250"/&gt;</code></pre>



<p>This can also be achieved by using CSS, though adding and removing images using HTML is easier.</p>



<h3><strong>How To Center Align An Image</strong></h3>



<p>The &lt;center&gt; tag which is now supported only in a few web browsers was earlier used to center align. The code for that is:</p>



<pre class="wp-block-code"><code>&lt;center&gt;
&lt;img src="html.png" alt="How to add an image"  height="180" width="250"/&gt;
&lt;/center&gt;</code></pre>



<p>Another feature that was available in older versions was using the middle tag attribute. Let us see how that worked:</p>



<pre class="wp-block-code"><code>&lt;img align="middle" src="inserthtml.png" alt="Center align the image"/&gt;</code></pre>



<p>But with the latest version of HTML, center align is done with CSS. For this, first, add an image using HTML.</p>



<pre class="wp-block-code"><code>&lt;p class="centeralign"&gt;
    &lt;img src=" inserthtml.png" alt=" Center align the image " /&gt;
&lt;/p&gt;</code></pre>



<p>To this, you now need to add the CSS code for class “centeralign”. Let us see how that is done.</p>



<pre class="wp-block-code"><code>&lt;style&gt;
.centeralign 
{
    text-align: center;
}
&lt;/style&gt;</code></pre>



<p>The above code is pretty self-explanatory. To learn more about <a href="https://cssnewbie.com/5-cssriffic-treatments-images/">adding effects to images using CSS</a>, you can check our blog!</p>



<h3><strong>How To Add A Background Image</strong></h3>



<p>Adding an amazing aesthetic to your website is inevitable and to do so one of the most basic ways is to add a background image. We can do this by building on what we have learned earlier.</p>



<p>We will use background attribute in the body tag and add a URL of the desired image. Remember, using the attribute in the body tag signifies we want the image on the entire page.</p>



<p> Let’s look at the code:</p>



<pre class="wp-block-code"><code>&lt;html&gt;
   &lt;body background=“inserthtml.png”&gt;
      &lt;h1&gt;Background image in HTML&lt;/h1&gt;
      &lt;p&gt;How to add an image in HTML&lt;/p&gt;
   &lt;/body&gt;
&lt;/html&gt;</code></pre>



<p>We can also use the attribute style in tags such as &lt;div&gt;,&lt;p&gt;, etc. It can be used as</p>



<pre class="wp-block-code"><code>style="background-image: url('inserthtml.jpg');"</code></pre>



<p>This will add the image only behind the content in these tags. You can try the above code using HTML Visual Studio.</p>



<h3>How To Add Hyperlink To An Image</h3>



<p> You can also add a hyperlink to an image. Let us see how you can do that:</p>



<pre class="wp-block-code"><code>&lt;a href="https://inserthtml.com"&gt;
   &lt;img src="html.gif" alt="add an image in HTML" width="90" height="110"&gt;
&lt;/a&gt;</code></pre>



<h3> Conclusion</h3>



<p>In this tutorial, we learned how to center an image in HTML, how to add a background image, and how to add a hyperlink to an image. It is important to note that the images added to a website should be small in size to keep the speed optimized. You can learn more about how <a href="http://www.html5canvastutorials.com/blog/2016/03/are-larger-images-harming-websites/">larger images harm a website here</a>!</p>



<p>Similar to images, you can also <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-center-text-in-html/">center text in HTML</a>. Another responsive feature that can be added to a website is <a href="https://code.tutsplus.com/articles/10-best-html5-sliders-for-images-and-text--cms-29995">image and text sliders</a>. To learn such other styling codes, subscribe to our <a href="http://www.html5canvastutorials.com/blog/">blog</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/how-to-center-an-image-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Center Text In HTML</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/how-to-center-text-in-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/how-to-center-text-in-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Tue, 01 Sep 2020 07:08:57 +0000</pubDate>
				<category><![CDATA[Site]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6109</guid>

					<description><![CDATA[Formatting and styling is an important step towards making a well-structured website. While CSS is generally used to style a webpage, HTML also provides a lot of options for formatting. Formatting tags in HTML are of two types: Physical tag: used for text styling i.e. to change the appearance of text Logical tag: this is a semantic tag used to&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="862" height="360" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/caq.png" alt="" class="wp-image-6110" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/caq.png 862w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/caq-300x125.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/caq-768x321.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></figure>



<p></p>



<p>Formatting and styling is an important step towards making a <a href="http://www.html5canvastutorials.com/blog/2015/11/what-do-well-constructed-websites-contain/">well-structured website</a>. While <a href="https://cssnewbie.com/stylize-checkboxes-and-text-fields-using-css/">CSS is generally used to style a webpage</a>, HTML also provides a lot of options for formatting.</p>



<p>Formatting
tags in HTML are of two types:</p>



<ul><li>Physical tag: used for text styling i.e. to change the appearance of text</li><li>Logical tag: this is a semantic tag used to give meaning to different parts of the text.</li></ul>



<p>For example, &lt;b&gt;, &lt;i&gt;, &lt;u&gt; are all physical tags and &lt;em&gt;, &lt;strong&gt; are logical tags.</p>



<p>&lt;b&gt; tag is used to make the text <strong>bold</strong>. Similarly &lt;i&gt; and &lt;u&gt; tags are used to make any text <em>italic</em> and <u>underlined</u> respectively.</p>



<p>On the other hand, &lt;em&gt; tag is used for <em>emphasized</em> text and the text is usually displayed as italic. &lt;strong&gt; tag is similar to &lt;em&gt; tag. It also <strong>emphasizes</strong> text but displays it as bold.</p>



<p>&#8220;Along with strongly encouraging semantic (meaningful) markup, the HTML5 specification strongly&nbsp;<strong>discourages</strong>&nbsp;non-meaningful markup &#8220;, says <a href="https://html.com/html5/">html.com</a>.</p>



<p>We just learned some basic formatting tags in HTML. Now let us see some other formatting styles in HTML.</p>



<p>In this tutorial, we will learn about how to center text in HTML? Further in the tutorial, we will also see how to change text color in HTML.</p>



<p>Until recently, HTML used to use &lt;center&gt; tag to center text. However, it no longer uses &lt;center&gt; tag to center-align text in its version 5. The alignment of the text in HTML5 can be achieved in two different ways.</p>



<h3>First Method</h3>



<p>We can use style as an attribute along with the text which contains string that has to be aligned. Remember we are still using the CSS feature to align our text. The example code below shows how ‘style’ is used inside the &lt;p&gt; tag. To align on right or left we can simply replace ‘center’ in text-align: center with left/right.</p>



<pre class="wp-block-code"><code>&lt;!DOCTYPE html&gt;
	&lt;html&gt;
	   &lt;head&gt;
	      &lt;title&gt; How to centre text in HTML &lt;/title&gt;
	   &lt;/head&gt;
	
	   &lt;body&gt;
	      &lt;h1&gt; colour text in HTML &lt;/h1&gt;
	      &lt;p style="text-align:center;"&gt; Learn HTML &lt;/p&gt;
	   &lt;/body&gt;
	&lt;/html&gt;
</code></pre>



<h4>Output</h4>



<figure class="wp-block-image size-large"><img width="1024" height="270" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Output-Center-text-1024x270.png" alt="" class="wp-image-6111" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Output-Center-text-1024x270.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Output-Center-text-300x79.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Output-Center-text-768x202.png 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/Output-Center-text.png 1438w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h3>Second Method</h3>



<p>The other way is similar but it defines the h1 and p tag earlier which is a preferable method once you start using CSS along.</p>



<p>This can be achieved by using the style tag inside HTML. Dive into the example code below to understand further:</p>



<pre class="wp-block-code"><code>&lt;html&gt;
   &lt;head&gt;
      &lt;style&gt;
      h1 {text-align: center;}
      p {text-align: center;}
      &lt;/style&gt;
   &lt;/head&gt;
   &lt;body&gt;
      &lt;h1&gt; How to center text in HTML &lt;/h1&gt;
      &lt;p&gt; Center text in HTML &lt;/p&gt;
   &lt;/body&gt;
&lt;/html&gt;
</code></pre>



<p>Now that you&#8217;ve understood how styling works in HTML, you can imagine what the output for the above code will be.</p>



<p>So we learned how to center text in HTML. Now let us take a look at how to change text color.</p>



<h3>How To Change Text Color In HTML</h3>



<p>Similar to the above example, the scope of style can be further expanded to color the text. Let us take an example:</p>



<pre class="wp-block-code"><code>&lt;h2 style="color:blue"&gt; Oceans are blue &lt;/h2&gt;</code></pre>



<pre class="wp-block-code"><code>&lt;h3 style="color:yellow"&gt;  Yellow is my favourite colour &lt;/h3&gt;</code></pre>



<h4>Output</h4>



<p><big><font color="blue">Oceans are blue</font></big></p>



<p><big><font color="yellow">Yellow is my favourite colour</font></big></p>



<h3>How To Center Align &amp; Change The Colour Of Text</h3>



<p>Now, to get both the desired results we just need to club both the style functionality without using style twice. &#8216;Text-align&#8217; as well as &#8216;color&#8217; format can be used together with a single style command. Check the following code:</p>



<pre class="wp-block-code"><code>&lt;p style="text-align:center;color:red;"&gt; Center align with red text &lt;/p&gt;</code></pre>



<p> You can try it yourself to see the result.</p>



<h3>Conclusion</h3>



<p>In this tutorial, we saw how to center text in HTML and how to change text color. These are some simple examples that can be learned even by a novice web developer. It is interesting to note that you can also <a href="https://code.tutsplus.com/tutorials/extending-the-html-by-creating-custom-tags--cms-28622">create custom tags in HTML</a>. </p>



<p>To learn <a href="http://www.html5canvastutorials.com/blog/2020/09/how-to-center-an-image-in-html/">how to center an image in HTML</a>, visit our previous blog. Subscribe to our <a href="http://www.html5canvastutorials.com/blog/">blog</a> to get more such tutorials!</p>



<p>You can also
see some tutorials in CSS such as:</p>



<p><a href="https://cssnewbie.com/creating-simple-and-interactive-pricing-tables-in-css/">Creating
Simple and Interactive Pricing Tables in CSS</a></p>



<p><a href="https://cssnewbie.com/15-new-awesome-creative-css-animations/">15 New Awesome Creative CSS Animations</a></p>



<p><a href="https://cssnewbie.com/replacing-font-tag-tips/">7 Tips For Replacing The Font Tag</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/how-to-center-text-in-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What Is HTML?</title>
		<link>https://www.html5canvastutorials.com/blog/2020/09/what-is-html/</link>
					<comments>https://www.html5canvastutorials.com/blog/2020/09/what-is-html/#respond</comments>
		
		<dc:creator><![CDATA[Jvalant Pandya]]></dc:creator>
		<pubDate>Tue, 01 Sep 2020 07:04:19 +0000</pubDate>
				<category><![CDATA[development]]></category>
		<guid isPermaLink="false">https://www.inserthtml.com/?p=6107</guid>

					<description><![CDATA[Before we read about ‘What is HTML?’, let us see how it came into being. Development Of HTML It has been 30 years since the first website was created. In 1990, in a small office at CERN, Tim-Berner’s Lee envisaged the idea of linking documents and getting them onto public networks. Since that day, HTML has evolved continuously. HTML is&#8230;]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img width="1024" height="705" src="http://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/code-3600810_1280-1024x705.png" alt="" class="wp-image-6108" srcset="https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/code-3600810_1280-1024x705.png 1024w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/code-3600810_1280-300x206.png 300w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/code-3600810_1280-768x529.png 768w, https://www.html5canvastutorials.com/blog/wp-content/uploads/2020/08/code-3600810_1280.png 1280w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Before we read about ‘What is HTML?’, let us see how it came into being.</p>



<h3>Development Of HTML</h3>



<p>It has been 30 years <a href="http://www.html5canvastutorials.com/blog/2015/12/its-been-25-years-since-the-creation-of-the-first-website/">since the first website was created</a>. In 1990, in a small office at CERN, Tim-Berner’s Lee envisaged the idea of linking documents and getting them onto public networks. Since that day, HTML has evolved continuously.</p>



<p>HTML is an acronym of ‘Hypertext Markup Language”. It is not a programming language. Rather, it is used to format text documents. Similarly, ‘ Hypertext’ is any text that links web pages. Thus, HTML is a language that links formatted and interactive web pages.</p>



<p>Now that we have a little idea about ‘What Is HTML?’, let us know more about how it has evolved:</p>



<h3><strong>Evolution Of HTML</strong></h3>



<p>The first version of HTML, HTML 1.0, was released in 1991. Subsequently, multiple versions of HTML have been created and used. Currently, HTML5, the 5<sup>th</sup> version of HTML, is used extensively to build modern web pages and web apps. &#8220;</p>



<p>According to an <a href="http://www.html5canvastutorials.com/">HTML5 tutorial blog</a>, “HTML5 has brought some exciting new advantages to the HTML coding world. Canvas allows you to render graphics powered by Javascript.”</p>



<p>&#8221; The&nbsp;<a href="https://www.w3.org/WebPlatform/WG/">Web Platform Working Group</a>&nbsp;continues the development of the HTML language and provides specifications that enable improved client-side application development on the Web.&#8221;, says <a href="https://www.w3.org/blog/2019/02/w3c-strategic-highlights-strengthening-the-core-of-the-web-html/">W3C</a>.</p>



<h3><strong>What Is HTML Used For</strong></h3>



<p>HTML, when used with CSS and Javascript, has become a key element of website development. CSS standardizes web layouts by describing how HTML elements will be displayed. On the other hand, Javascript is responsible for the way the content behaves. Learn more about <a href="http://cssnewbie.com/">CSS</a> and <a href="https://www.learningjquery.com/">Javascript</a> in these blogs!</p>



<p>Along with building dynamic web pages, HTML is also used to link these web pages. This is where Hypertext comes into play. Using Hypertext, one can navigate from one web page to another. Thus, HTML can be used to create user flows.</p>



<p>Let us now look at an example of a simple webpage using HTML. In this example, we will create a paragraph with the heading ‘What is HTML?’.</p>



<h3><strong>First Example Of HTML</strong></h3>



<pre class="wp-block-code"><code>&lt;html>  
    &lt;head>  
       &lt;title> HyperText Markup Language &lt;/title>  
    &lt;/head>  
    &lt;body>  
       &lt;h1>  What is HTML &lt;/h1>  
       &lt;p>
           What is HTML? HTML is an acronym of ‘Hypertext Markup Language”. 
       &lt;/p>  
    &lt;/body>  
&lt;/html>  </code></pre>



<p>As you can see, HTML uses angular brackets ‘&lt;’ &amp; ‘&gt;’ to differentiate the annotations from regular text. This is an extension of a previous language, SGML (Standard Generalised Markup Language). It tells the browser that the next string is a markup.</p>



<h3><strong>Components Of HTML</strong></h3>



<p>Anything between the angular brackets is known as a tag. For example, &lt;head&gt;, &lt;body&gt;, &lt;p&gt; are all <strong>tags</strong>.</p>



<p>Similarly, starting tag(eg. &lt;head&gt;), ending tag (eg. &lt;/head&gt;), and everything in between is together known as an <strong>element</strong>. Here, header, body, paragraph are all elements which are pieces in itself.</p>



<p>Another important component of HTML is attributes. <strong>Attributes</strong> are additional characteristics and are always mentioned in starting tag. For example,</p>



<p><code>&lt;p id= “para-1” class= “learning-HTML”&gt;
Ceres is an ocean planet &lt;/p&gt;</code></p>



<p>The ‘id’ and ‘class’ are the attributes used to
uniquely identify with “para-1” and is a part of a class “learning-HTML”. </p>



<p>The statement used in between tags is not going to affect the attributes. Elements, Tags &amp; Attributes are the important constituents of HTML which makes the modern web pages shine.</p>



<h3><strong>Understanding The Example</strong></h3>



<p>&lt;html&gt; tag tells the browser that this an
HTML document. It contains web content in between.</p>



<p>&lt;head&gt; tag is used before the &lt;body&gt;. This tag mentions information about the document.</p>



<p>&lt;body&gt; tag contains the main body of the
web page.</p>



<p>&lt;p&gt; tag is used to write paragraphs in a
web document and &lt;h1&gt; tag is used to write a heading.</p>



<p>Similarly, you can also add an image to your
webpage using the below code.</p>



<p><code>&lt;img src="C/inserthtml.jpeg" alt="What
is HTML?"&gt;</code></p>



<p>This tag contains two attributes: src which specifies the source of the image and alt which provides an alternate text to describe the image.</p>



<p>Last but not the least, let us take a look at the main functionality of HTML i.e. linking webpages. A hyperlink is used to navigate between websites. I’m sure you would have seen sentences like &#8216;Find more blogs <a href="http://www.html5canvastutorials.com/blog/2016/03/are-larger-images-harming-websites/">here</a>&#8216;. Try clicking the link above. It will take you to one of the articles on this website. A hyperlink can work on both texts as well as images.</p>



<h3>Conclusion</h3>



<p>In this blog, we learned ‘What is Html?’. HTML is the most popular markup language to build websites today. You can learn more about it in our posts <a href="http://www.html5canvastutorials.com/blog/">here</a>!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.html5canvastutorials.com/blog/2020/09/what-is-html/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
