Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

How to html code?

5 Answer(s) Available
Answer # 1 #

A simple text editor is all you need to learn HTML.

Web pages can be created and modified by using professional HTML editors.

However, for learning HTML we recommend a simple text editor like Notepad (PC) or TextEdit (Mac).

We believe that using a simple text editor is a good way to learn HTML.

Follow the steps below to create your first web page with Notepad or TextEdit.

Windows 8 or later:

Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad.

Windows 7 or earlier:

Open Start > Programs > Accessories > Notepad

Open Finder > Applications > TextEdit

Also change some preferences to get the application to save files correctly. In Preferences > Format > choose "Plain Text"

Then under "Open and Save", check the box that says "Display HTML files as HTML code instead of formatted text".

Then open a new document to place the code.

Write or copy the following HTML code into Notepad:

Save the file on your computer. Select File > Save as in the Notepad menu.

Name the file "index.htm" and set the encoding to UTF-8 (which is the preferred encoding for HTML files).

Open the saved HTML file in your favorite browser (double click on the file, or right-click - and choose "Open with").

The result will look much like this:

With our free online editor, you can edit the HTML code and view the result in your browser.

It is the perfect tool when you want to test code fast. It also has color coding and the ability to save and share code with others:

Click on the "Try it Yourself" button to see how it works.

If you want to create your own website and save your code online, try our free website builder, called W3schools Spaces:

[5]
Edit
Query
Report
Answer # 2 #

Whether you are a novice, hoping to delve into the world of web design or an experienced webmaster keen to improve your skills, we’ve got online tutorials tailored to your web design needs.

Our absolute beginner tutorial will turn you from wannabe to webmaster in just a few hours. Unlike many other HTML tutorials, it’s a step-by-step guide – not a boring long-winded reference.

Our step-by-step guide teaches you the basics of HTML and how to build your first website. That means how to layout an HTML page, how to add text and images, how to add headings and text formatting, and how to use tables.

We’ll get you building your new website in minutes, not hours.

While many guides on the internet attempt to teach HTML using a lot of mind-boggling theory, this tutorial will instead focus on giving you the practical skills to build your first site.

The aim is to show you ‘how’ to create your first web page without spending the entire tutorial focusing too much on the “why.”

By the end of this tutorial, you will have the know-how to create a basic website and we hope that this will inspire you to delve further into the world of HTML using our follow-on guides.

Okay, so this is the only bit of mandatory theory. In order to begin to write HTML, it helps if you know what you are writing.

HTML is the language in which most websites are written. HTML is used to create pages and make them functional.

The code used to make them visually appealing is known as CSS and we shall focus on this in a later tutorial. For now, we will focus on teaching you how to build rather than design.

HTML was first created by Tim Berners-Lee, Robert Cailliau, and others starting in 1989. It stands for Hyper Text Markup Language.

Hypertext means that the document contains links that allow the reader to jump to other places in the document or to another document altogether. The latest version is known as HTML5.

A Markup Language is a way that computers speak to each other to control how text is processed and presented. To do this HTML uses two things: tags and attributes.

Tags and attributes are the basis of HTML.

They work together but perform different functions – it is worth investing 2 minutes in differentiating the two.

Tags are used to mark up the start of an HTML element and they are usually enclosed in angle brackets. An example of a tag is:

.

Most tags must be opened

and closed

in order to function.

Attributes contain additional pieces of information. Attributes take the form of an opening tag and additional info is placed inside.

An example of an attribute is:

In this instance, the image source (src) and the alt text (alt) are attributes of the tag.

Now that we’ve gotten the basic theory out of the way. It’s time to learn how to build our first website.

First off, we must ensure that we have the right tools. Most important, we need an HTML editor.

There are many choices on the market. Here are a handful of the most popular:

However, for this tutorial, we will use the Sublime Text 3 as it is free and also offers cross-platform support for Windows, Mac, and Linux users.

Another common choice for HTML and other language coders is Notepad ++. It is a tiny program to download and perform the functions you need for writing clean code.

Komodo Edit is one of two editors released by the same label. They offer a simple, open-source editor with a variety of extensions and language support.

It is free to download.

Do not use Microsoft Word or any other word processor when writing HTML code, only an HTML editor or at the very least, your machine’s built-in notepad, is suitable for the task.

Secondly, ensure that you’ve installed a number of different browsers such as Chrome and Firefox in order to preview your upcoming creation.

First off, you need to open your HTML editor, where you will find a clean white page on which to write your code.

From there you need to layout your page with the following tags.

These tags should be placed underneath each other at the top of every HTML page that you create.

Inside the tag, there is one tag that is always included: , but there are others that are just as important:</p><p>Let’s try out a basic <head> section:</p><p>Next, we will make <body> tag.</p><p>The HTML <body> is where we add the content which is designed for viewing by human eyes.</p><p>This includes text, images, tables, forms and everything else that we see on the internet each day.</p><p>In HTML, headings are written in the following elements:</p><p>As you might have guessed <h1> and <h2> should be used for the most important titles, while the remaining tags should be used for sub-headings and less important text.</p><p>Search engine bots use this order when deciphering which information is most important on a page.</p><p>Let’s try it out. On a new line in the HTML editor, type:</p><p>And hit save. We will save this file as “index.html” in a new folder called “my webpage.”</p><p>Well let’s not get carried away; we’ve still got loads of great features that we can add to your page.</p><p>Adding text to our HTML page is simple using an element opened with the tag <p> which creates a new paragraph. We place all of our regular text inside the element <p>.</p><p>When we write text in HTML, we also have a number of other elements we can use to control the text or make it appear in a certain way.</p><p>They are as follows:</p><p>These tags must be opened and closed around the text in question.</p><p>Let’s try it out. On a new line in the HTML editor, type the following HTML code:</p><p>Don’t forget to hit save and then refresh the page in your browser to see the results.</p><p>As you may have noticed, the internet is made up of lots of links.</p><p>Almost everything you click on while surfing the web is a link takes you to another page within the website you are visiting or to an external site.</p><p>Links are included in an attribute opened by the <a> tag. This element is the first that we’ve met which uses an attribute and so it looks different to previously mentioned tags.</p><p>The <a> (or anchor) opening tag is written in the format:</p><p>The first part of the attribute points to the page that will open once the link is clicked.</p><p>Meanwhile, the second part of the attribute contains the text which will be displayed to a visitor in order to entice them to click on that link.</p><p>If you are building your own website then you will most likely host all of your pages on professional web hosting. In this case, internal links on your website will <a href=”mylinkedpage.html”>Link Title Here</a>.</p><p>Let’s try it out. Make a duplicate of the code from your current index.html page. Copy / paste it into a new window in your HTML editor.</p><p>Save this new page as “page2.html” and ensure that it is saved in the same folder as your index.html page.</p><p>On page2.html add the following code:</p><p>This will create a link to Google on page 2. Hit save and return to your index.html page.</p><p>On a new line on index.html add the following code:</p><p>Ensure the folder path to the file (page2.html) is correct. Hit save and preview index.html in your browser.</p><p>If everything is correct then you will see a link which will take you to your second page. On the second page, there will be a link that will take you to google.com.</p><p>In today’s modern digital world, images are everything. The <img> tag has everything you need to display images on your site. Much like the <a> anchor element, <img> also contains an attribute.</p><p>The attribute features information for your computer regarding the source, height, width and alt text of the image.</p><p>You can also define borders and other styles around the image using the class attribute. However, we shall cover this in a later tutorial.</p><p>The file types generally used for image files online are: .jpg, .png, and (less and less) .gif.</p><p>Alt text is important to ensure that your site is ranked correctly on search sites and also for visually impaired visitors to your site.</p><p>The <img> tag normally is written as follows:</p><p>Let’s try it out.</p><p>Save an image (.jpg, .png, .gif format) of your choice in the same folder where you’ve saved index.html and page2.html. Call this image “testpic.jpg.”</p><p>On a new line in your HTML editor enter the following code:</p><p>Hit save and preview the index.html page in your browser.</p><p>In web design, there are 3 different types of lists which you may wish to add to your site.</p><p>The first is an <ol>: This is an ordered list of contents. For example:</p><p>Inside the <ol> tag we list each item on the list inside <li> </li> tags.</p><p>For example:</p><p>The second type of list that you may wish to include is an <ul> unordered list. This is better known as a bullet point list and contains no numbers.</p><p>An example of this is:</p><p>Finally, you may wish to include a definition list <dl> on your page. An example of a <dl> list is as follows:</p><p>The code used for the above is as follows:</p><p>Let’s try it out. Open index.html and on a new line, enter the following HTML:</p><p>Now hit save and check out the results in your browser. If everything worked out then it will display a bullet-pointed table displaying the information above.</p><p>Another way to keep your website looking neat and orderly is through the use of a table.</p><p>This is definitely the most complicated part of this tutorial, however, learning it will certainly pay off in the long-run.</p><p>With this in mind, tables can still be a useful way to present content on your page.</p><p>When drawing a table we must open an element with the <table> opening tag. Inside this tag, we structure the table using the table rows, <tr>, and cells, <td>.</p><p>An example of an HTML table is as follows:</p><p>This will produce a 2-row table with 3 cells in each row.</p><p>Tables can get quite complicated, so be sure to check out our special HTML tables tutorial.</p><p>However, watch out for these tags so that you can recognize them and use them as your skills develop.</p><p>Here are the tables tags presented in a table – pun totally intended.</p><p>Tables, borders, spacing are usually styled using CSS but we will cover this in a later tutorial.</p><p>Go to a new line on the index.html page within your text editor. Enter the following HTML code:</p><p>Hit save and preview it in your browser.</p><p>Congratulations: You did it!</p><p>You’ve reached the end of our absolute beginners HTML tutorial.</p><p>The final step we need to complete is to close the <body> and <html> tags at the end of each page using the following HTML code:</p><p>You’ve also learned to add headings, text, images, links, lists and basic tables to these pages.</p><p>You can now use this knowledge to create your own web pages containing these features and link them together.</p><p>We suggest that you further enhance your skills by experimenting with the code you’ve learned using different variables. You may also wish to learn about how to make your pages beautiful using CSS.</p><p>The power to create your own website is now in your hands.</p><p>In case things didn’t work out as intended, simply check your HTML code against the examples below.</p><p>Index.html troubleshooting code:</p><p>page2.html troubleshooting code:</p><p>Our HTML tutorials teach you how to create a personal website or site for your business, without forcing you to learn unnecessary theory.</p><p>Our most popular beginner’s tutorials include:</p><p>HTML tables</p><p>Links</p><p>Forms</p><p>Fonts</p><p>Images</p><p>We’ve plenty of topics for intermediate and advanced HTML learners, too:</p><p>CSS tutorials</p><p>JavaScript</p><p>HTML5</p><p>Video: This 3 minute crash course is a great way to start understanding HTML5.</p><p>Semantic Markup</p><p>Logical tags</p><p>Meanwhile, our detailed HTML tags reference lets you find out more about every single HTML tag from <a> to <xmp>.</p><p>Each tag reference includes background and examples, which show how to use the tag in question. It’s perfect for when you want to troubleshoot problems while coding HTML.</p><p>Below are some of the most common tags — used by nearly every website you encounter:</p><p>Button Tag</p><p>Anchor Tag</p><p>Link Tag</p><p>Image Manipulation</p><p>Character Codes</p><p>Headings</p><p>Paragraph</p><p>Italics</p><p>Bold</p><p>Anchor</p><p>Unordered List</p><p>List Item</p><p>Blockquote</p><p>Horizontal Rule</p><p>Image</p><p>Division</p><p>The HTML attributes section is designed to allow you to get up close and personal with the HTML attributes that you know and love while introducing you to some advanced attributes along the way.</p><p>Our most popular attributes include:</p><p>If you are pretty confident in your HTML abilities but sometimes feel like double-checking your work then look no further than our HTML cheat sheet.</p><p>This handy guide will show you everything you need to know about HTML in a super-compact, and easy-to-understand format. It provides information on particular tags and specific attributes in an alphabetized format.</p><p>You can bookmark the page for easy retrieval. Or you can print out our PDF so you can keep it by your desk.</p><p>Our blog includes posts covering all corners of the internet.</p><p>Why Did The British Government Ban These 10 Websites?</p><p>100+ Places to Post and Share Your Photos Online</p><p>Google Calendar: 50 Themes, Hacks & Add-Ons</p><p>Homebrew Nintendo Wii Hacks & Mods</p><p>The 20 Best Internet Scam Stories</p><p>What Is Doxxing?</p><p>If you’ve already built your website then look no further than the HTML.com guide to web hosting.</p><p>We’ll help you find the best hosting provider for your website.</p><p>Whether you are searching for a WordPress host, a cheap and cheerful space for your first website, or a dedicated hosting solution, our hosting section has reviews of all the big name hosting providers and a few smaller companies too, including:</p><p>SiteGround</p><p>Bluehost</p><p>iPage</p><p>HostGator</p><p>WP Engine</p><p>Now that you’ve gotten started with HTML, you can improve your skills. It’s exciting to see everything you can do with web pages. Check out more of our tutorials and start learning now!</p> </div> <div class="show-complete-answer-option-box"> <button class="show-complete-answer">-Complete Answer-</button> </div> <div class="answer-box-secondary-options"> <div><button class="upvote-answer" data-ans-id="xJPrRZNtJYfA"><img src="https://asksawal.com/static/icons/site-icons/thumbs_up.svg" alt="Upvote Icon"></button> <span>[2]</span></div> <div> <div>Edit</div> <div>Query</div> <div class="report-answer">Report</div> </div> </div> <div class="answer-author-box"> <div><img src="https://asksawal.com/media/profiles/rnhqx824lqol.jpg" alt="Radhika vsoepdu" width="27" height="27" class="author-profile-image"></div> <div><a href="https://asksawal.com/member/rnhqx824lqol">Radhika vsoepdu</a></div> <div> <i>MOLDER PIPE COVERING</i> </div> </div> <div class="social-media-sharing-options-wrapper"> <div><a href="https://www.facebook.com/sharer/sharer.php?u=" target="_blank" rel="nofollow noopener"><img src="https://asksawal.com/static/social-icons/facebook.png" alt="Share on Facebook"></a></div> <div><a href="https://twitter.com/intent/tweet?text=' '" target="_blank" rel="nofollow noopener"><img src="https://asksawal.com/static/social-icons/twitter.png" alt="Tweet on Twitter"></a></div> <div><a href="https://www.linkedin.com/shareArticle?mini=true&url=&title=&summary=&source=LinkedIn" target="_blank" rel="nofollow noopener"><img src="https://asksawal.com/static/social-icons/linkedin.png" alt="Share on Linkedin"></a></div> <div><a href="whatsapp://send?text=" target="_blank" rel="nofollow noopener"><img src="https://asksawal.com/static/social-icons/whatsapp.png" alt="Share on Whatsapp"></a></div> </div> </div> <div class="answer-projector-main-box" id="aFcUoS2InNNq"> <strong>Answer # 3 #</strong> <div class="answer-projector-body"> <p>In this guide to HTML for beginners, we’ll learn what HTML is and what it’s used for. Then, we’ll walk through how to write some basic HTML and review some of its most important elements and attributes. We’ll end with a brief look at some resources you can use to continue learning and using HTML.</p><p>Let’s get started.</p><p>First published by Tim Berners-Lee in 1989, HTML is now used by 94% of all websites, and probably all the ones you visit. But what is it, exactly?</p><p>First, check out this short video for a quick definition of HTML, then we'll dive deeper:</p><p>As mentioned above, HTML is an acronym for “HyperText Markup Language.” Let’s break this down to better understand what HTML actually means.</p><p>“HyperText” is text on a web page that contains references to another web page. You probably know these as hyperlinks. We use hyperlinks to jump to another section of the same page, a different page on the current website, or a completely new website. Hyperlinks can also open a PDF, email, or multimedia, like a video or audio file.</p><p>Linking information together in this way was a revolutionary step in building the web. Together, HTML and the internet make it possible for anyone to access all types of information around the world, in any order they want.</p><p>Moving on, “Markup” refers to how HTML “marks up” the page with annotations within the HTML file. These annotations are not displayed on the web page itself. Instead, they work behind-the-scenes telling the browser how to display the document to visitors. We'll learn more about this markup soon.</p><p>Finally, “Language” is the simplest part of the acronym to understand. Like any language, HTML has a unique syntax and alphabet. But what kind of language is it, exactly? Let’s tackle this question next.</p><p>Whether HTML is or is not technically a “programming” language is an ongoing debate among web developers and experts. While the majority defines HTML as a “markup” language (not a programming language) some argue the two aren’t mutually exclusive.</p><p>All programming languages have some functional purpose — they need to “do” something, whether it be evaluating expressions, declaring variables, or modifying data. JavaScript is the most widely-used programming language in web development. Other popular programming languages include Python, Java, and C.</p><p>Though it’s very useful as we’ll see, HTML doesn’t really “do” anything in this sense. It simply gives browsers the content it needs to display. HTML doesn’t care how the browser goes about displaying the content, as long as it’s displayed. In other words, HTML has a structural purpose, not a functional one.</p><p>Still, some developers use this same logic to argue that HTML is a programming language — it’s just a declarative programming language. According to Professor David Brailsford from the University of Nottingham, declarative languages are more restricted than other languages, but that doesn’t make them any less of a programming language. You can see his full argument in this video.</p><p>With that in mind, let’s move on to what HTML is used for.</p><p>HTML is primarily used for creating web pages. HTML is free to use and ensures your text, images, and other elements are displayed as intended.</p><p>With HTML, not only can you add headings, paragraphs, lists, and other elements to your page — you can also embed images, videos, audio files, and other multimedia. And, you can link to other web pages on the same website or from another site. This allows visitors to easily navigate your website and jump between websites.</p><p>Even after adding headings, images, and hyperlinks, you’d still have a very basic web page — and that’s by design. HTML is purely for the content of a page. It creates a simple base upon which you can add styling with another language called CSS (which stands for Cascading Style Sheets). With CSS, you can customize your styling and layouts, changing the color, font, and alignment of elements.</p><p>HTML is used to create things other than web pages, too. You can use it to:</p><p>Whether you want to create web pages, tables, forms, or emails, you'll need to know how to write HTML. So, let’s break down the process next.</p><p>Compared to other coding languages, HTML is relatively easy to read and understand, since it’s essentially plain English text with extra symbols here and there.</p><p>The main building block of an HTML web page is an element. An HTML element is a unit of information that tells the web browser what to render for the viewer. An HTML element could be a piece of text like a paragraph, an interactive item like a button, or a section of the page like a header or footer.</p><p>Here’s what a basic element looks like written out in HTML. This element is called the <button> element, and creates a button on the screen that users can click with the mouse.</p><p>Let's take a closer look at each component of an HTML element.</p><p>HTML elements are designated by tags. Most elements have an opening tag and a closing tag. Opening tags precede contain the element name enclosed by angle brackets (<>). Closing tags are identical to opening tags, save for a slash (/) that precedes the element name.</p><p>Tags contain an element’s content. Content may be text, a media item, or even other elements.</p><p>So, say you want to add a paragraph to your web page, the the paragraph contains the text “This is a paragraph.” You’ll wrap it with the HTML paragraph tags <p> and </p>. So, the HTML will look like this:</p><p>Simple as that. Together, these three things are all you need make a paragraph element in HTML.</p><p>Most HTML elements have an opening tag, a closing tag, and content in between these tags. However, some HTML elements only have an opening tag — these are called empty elements.</p><p>The line break element is a common empty element. To add a line break in HTML, you just need to write <br> (for “break”), and a line break will be added.</p><p>Also, element names are case-insensitive, meaning they can be written in uppercase or lowercase. For example, the <p> tag can also be written as <P>. However, you’ll almost always see element names written in lowercase.</p><p>While all HTML elements need tags, only some require attributes. An HTML attribute is text inside of the opening tag that provides additional information about the HTML element.</p><p>An attribute is always found in the opening tag of an HTML element. Most have the syntax name=“value”, though some attributes only require you to write the name without any assigned value.</p><p>Some elements require certain attributes. For example, an HTML image element (<img>) must always contain a source attribute (src) whose value is the image URL or file path. Otherwise, the browser will not know what image to render.</p><p>Similarly, the anchor element (<a>), which creates a hyperlink, must contain an href attribute with a value that specifies the link’s destination. Otherwise, if a visitor clicks on the anchor element, the browser won’t send them anywhere.</p><p>Other elements have attributes that aren’t essential to include, but are considered a good practice. For example, the <img> element also takes the alt attribute, which contains image alt text. The browser will still render the image if the alt attribute is not present in the <img> tag. But, readers with low vision might have trouble understanding what the image conveys without an alternative text description. So, it’s recommended that all non-decorative images have alt text and therefore use the alt attribute.</p><p>Attributes can be written in any order inside the opening tag. However, you cannot put multiple instances of the same attribute inside the same HTML tag.</p><p>To start using HTML, you’ll need a text editor. A text editor is a software program for writing code. Since an HTML file is in standard text format, any basic text editor will work for this tutorial.</p><p>Your first step will be to download a free text editor to use. Notepad++ is a good free text editor for Windows, and Sublime Text is a popular option for Mac. Usually, you can search the text editor online and download a zip file from the download page. Open the zip file, follow any instructions given to install the program, and open it.</p><p>When you open the text editor, you’ll likely see an editor window like the one below. This is where you’ll write your HTML code.</p><p>With this editor window open, copy the HTML code below and paste it into the window.</p><p>We’ll explain what each of these elements means in the following section.</p><p>Next, save the file and name it “index.html.” You can save it to your desktop or another folder.</p><p>After saving the HTML file, you’ll be able to open this file in your web browser. To do this, you can double click on the file, right-click and choose Open, or drag and drop the file icon into an open browser window. It will look like this:</p><p>Now that you know how to use an HTML editor, let’s look at how to write the actual code.</p><p>To build a website with HTML, you need to create an HTML file first. This file will contain all the HTML for your web page and will be uploaded to your web server. That way, when a visitor searches for your website, the server will send the HTML file to the visitor's browser, and the browser will render the page accordingly.</p><p>In the last section, we made a very simple HTML file to open in your browser. In this section, we’ll walk through the process of building out a more complex one.</p><p>To start, we’ll need declare the type of document as HTML. Add the special code <!DOCTYPE html> on the very first line of the file. Every HTML file starts this way.</p><p>Next, we’ll add the <html> element after the doctype declaration, also called the “root” element of the document because it contains all other elements in the document.</p><p>On the line below the DOCTYPE declaration, add an <html> opening tag. Below that, add a closing </html> tag.</p><p>Every other element in the document will be placed between these tags.</p><p>Within the opening tag of the html element, we’ll also add a lang (language) attribute. This helps screen readers determine what language the document is in, making your website more accessible.</p><p>Without a language attribute, screen readers will default to the operating system’s language, which could result in mispronunciations of the title and other content on the page.</p><p>Since we’re writing this post in English, we’ll set the file’s lang attribute value to en.</p><p>An HTML document consists of two parts: the head section and the body section. The head section contains meta-information about the page as well as any internal CSS. The browser does not display this information to users. The body section contains all the information that will be visible on the front end, like your paragraphs, images, and links.</p><p>To create these sections, we will add <head></head> tags and <body></body> tags inside the <html> section of the document.</p><p>You’ll also notice that the <head> and <body> tags are indented here. This visually indicates to us that these tags are placed inside, or “nested” in, the <html> tags. While indenting isn’t necessary and makes no difference in how the browser renders the document, it’s still common practice to indent your HTML for better readability.</p><p>Next, in the head section, we want to name our document. Write a name (we’ll go with “My HTML Page” in this example) and then wrap it in <title> tags. We’ll also indent this element so show that it is nested in the <head> section.</p><p>In the head section, you'll want to name your document. Write a name (we’ll go with “My HTML Page” in this example) and then wrap it in <title> tags.

In the body section, let’s now add a heading and paragraph. Write out the heading content and wrap it in

tags, then write out the paragraph content and wrap it in

tags.

We now have a basic HTML file that will load in your browser. Here’s what our completed file looks on the front end.

Below is how it would look on the front end. Note that only the heading and paragraph from the body section are rendered.

See the Pen HTML tutorial: final by HubSpot (@hubspot) on CodePen.

As you can see, this is a pretty skeletal page. To fill it, we need to learn some more page elements. Page elements are elements that are actually rendered on the front end. We’ve already used two of them,

and

. Let’s take a closer look at these page elements and others next.

If you'd prefer to watch how a more complex HTML file is built out with images, links, forms, and other elements, check out this video:

The first version of HTML consisted of just 18 elements. Since then, more versions have been released with dozens of tags added in each one. In the most recent version of HTML, HTML5, there are 110 HTML tags.

Don’t worry, though — there are only a handful that you’ll use the most often. Below we’ll review the most common elements and their tags.

Below we’ll review the most common elements and their tags.

The HTML paragraph element represents a paragraph. By placing

tags around text, you’ll make that text start on a new line.

See the Pen p example by Christina Perricone (@hubspot) on CodePen.

The HTML image element embeds an image into the document. It requires a src (source) attribute to render properly. An alt attribute should also be included in case the image doesn’t load properly or the reader has a visual impairment.

Here’s an example of an image with a source and alt attribute:

See the Pen img example by Christina Perricone (@hubspot) on CodePen.

The HTML heading elements represent different levels of section headings.

is the highest section level and the most prominent, whereas

is the lowest and therefore least prominent.

See the Pen headings example by Christina Perricone (@hubspot) on CodePen.

The HTML content division (div) element is a generic block-level container. Div elements help organize the code into clearly marked sections. They also add line breaks before and after their content. Otherwise, they do not affect the content or layout of the page unless styled with CSS.

Here’s an example of div wrapped around an image:

See the Pen div example 1 by Christina Perricone (@hubspot) on CodePen.

Here, the image looks the same as it did without the div wrapper element. That’s because no style information was given to this div element. To change the appearance of the container and therefore the image inside that container, you’d need to add style information.

Say, for example, you wanted to center the image. Then you could use the following code to horizontally center the image on the page:

See the Pen div example 2 by Christina Perricone (@hubspot) on CodePen.

The HTML span element is a generic inline container. Span tags do not inherently represent anything, but they are used to group phrasing content for two reasons.

The first is to apply styling to a piece of text. For example, if you’re creating drop caps, you can wrap the first letter of the opening paragraphs of each section of your article in span tags.

See the Pen span example by Christina Perricone (@hubspot) on CodePen.

The second reason to use span tags is to group elements that already share attribute values. For example, maybe you have a website for English speakers learning French. The default language is set to English but on several pages, you might have a table with French terms in the first column and their English translations in the second column. In that case, you can wrap the French terms in span tags with the language attribute set to “fr.”

The HTML anchor element creates a hyperlink. The anchor element requires an href attribute, which species the destination of the link. The destination can be another section on the same web page or another web page on the same site, or external websites, files, and email addresses.

Here’s an example of a link nested in a paragraph:

See the Pen anchor example by Christina Perricone (@hubspot) on CodePen.

The line break element creates a line break where it’s placed. That means you can add it wherever you want the text to end on the current line and resume on the next. This element can be used to display poems, song lyrics, or other forms of content in which the division of lines is significant.

Below is an example of an address rendered in two ways: one using line break elements and one using paragraph elements.

See the Pen Paragraph vs Line Break Element by HubSpot (@hubspot) on CodePen.

The HTML unordered list element is used for grouping items when the order doesn't matter. Shopping lists, for example, don’t need to follow a particular order. List items are defined by the

  • tag and wrapped in the
      element.

      Here’s an example of an unordered list. Try adding some list items yourself and see how the list changes.

      See the Pen ul example by Christina Perricone (@hubspot) on CodePen.

      The HTML ordered list element is used for grouping items when the order matters. Recipes, for example, should follow a particular order. The steps must be defined by the

    • tag and then wrapped in the
        element.

        An ordered list will start at the number 1 by default. If you’d like to start at another number, add a start attribute and set the value to the number you want.

        Here’s an example of an ordered list that starts at 1. Try adding steps at different parts of the list:

        See the Pen ol example by Christina Perricone (@hubspot) on CodePen.

        The HTML emphasis element signals that the text inside it should be emphasized. Browsers typically render text inside tags in italics.

        Here’s an example of the emphasis wrapped around a paragraph and nested within a paragraph:

        See the Pen em example by Christina Perricone (@hubspot) on CodePen.

        The HTML strong element indicates that the text it contains is of particular importance or urgency. Browsers typically render the text in bold.

        See the Pen strong example by Christina Perricone (@hubspot) on CodePen.

        The

        element creates a table for organizing content. It requires three other HTML elements:

        Here's an example of a table:

        See the Pen Untitled by HubSpot (@hubspot) on CodePen.

        The horizontal rule element defines a horizontal line across a web page. It can be used to mark any thematic change, like the next scene in a play, a new section of an essay, or the conclusion of an article.

        See the Pen Horizontal Rule element by HubSpot (@hubspot) on CodePen.

        The select element defines a dropdown list of options, from which a user can select one option (or multiple if allowed). The select element is usually used in HTML forms for gathering user submissions. It’s best for selecting one option out of many while maximizing space on the web page.

        See the Pen HTML-only Dropdown by HubSpot (@hubspot) on CodePen.

        Attributes modify HTML elements in different ways. They can change the appearance of the element, apply unique identifiers so the elements can be targeted by CSS, or provide necessary information to readers or screen readers.

        Attributes usually appear lowercase and as name/value pairs, with their values in quotes.

        Below we’ll take a look at the most common attributes.

        The style attribute contains inline CSS. This CSS will override any styles set in the head section of the document or in an external stylesheet. It will only be applied to the HTML element that has the style attribute in its opening tag.

        Here’s an example of the attribute in HTML:

        The ID attribute is used to identify a single element in an HTML file. That means the value of an ID attribute should not be repeated inside the same file. Using this unique value, you can target a single element with internal or external CSS.

        Here’s an example of the attribute in HTML:

        The class attribute is used to identify a group of elements under the same name and customize that group, effectively creating a new group of elements.

        Bootstrap buttons, for example, are all labeled with the .btn class so they have the same basic style: 14px font, medium size, rounded edges, etc.

        Here’s an example of the attribute in HTML:

        As mentioned, the language attribute signals to screen readers what the primary language of the web page is and when they need to switch to another language. This is a small detail that can make your content more accessible to all readers, no matter what region they’re from or the language they speak.

        While this attribute is most commonly embedded in the HTML element, it can also be used with paragraph, div, span, and other elements.

        Here’s an example of the attribute in HTML:

        An href attribute contains the destination of a link. This attribute must always be included with an anchor element.

        Here’s an example of the href attribute in HTML:

        Just like an anchor element needs an href attribute, an image needs a source attribute. This contains the path to the image file or its URL.

        Here are two examples of the attribute in HTML:

        The alt attribute provides descriptive information about the HTML element. This is important for readers with visual impairments and for all readers in case the element doesn’t load. In that case, readers will still be able to glean what the element was meant to convey. Like the source attribute, you’ll most often find the alt attribute with the image element.

        Here’s an example of the attribute in HTML:

        The data-* attribute is used to store custom data that is private to the page or application. You can use this stored data in the document’s JavaScript to create a more dynamic experience for the user.

        The asterisk in the data-* attribute can be any value.

        Here’s an example of the attribute in HTML from W3Schools:

        I could then use this data in the JavaScript to trigger a pop-up message providing more information about each list item. Say, for example, a visitor clicked on the word “Owl.” Then a pop-up box would appear saying “The owl is a bird," as shown in the screenshot below.

        Now that we’ve covered the most common elements and attributes in HTML, let’s explore where you can practice writing this language and continue learning more about it.

        There are hundreds of resources available to learn HTML for beginners or more advanced developers. Depending on your learning style, you may prefer to read blog posts, watch video tutorials, take online courses, download an ebook, or use a combination of all of these resources.

        Below we’ll walk through at least one example of each of these content types. That way, no matter what type of learner you are, you can find a resource that will help you learn this language.

        If you're just starting to learn to code, this free e-book is designed to teach HTML for beginners. It will explain what HTML and CSS are, how they’re different, and how to get started if you're brand new to web development. As the title suggests, this guide is specifically designed for marketers who need to be able to make quick fixes to their websites, blogs, and landing pages.

        If you’re a visual learner, check out the online tutorials available at LinkedIn Learning (formerly known as Lynda.com). LinkedIn Learning offers 42 courses and over 5,000 video tutorials that cover virtually every HTML topic, from forms to semantic data to everything in between. These lessons are organized into three levels — beginner, intermediate, and advanced — so you can develop your skills over time. To get access to all content on the site, you can sign up for a monthly or annual subscription.

        The video below is an excerpt from one course called “HTML Essential Training” by Jen Simmons:

        If you’re overwhelmed by the sheer quantity of videos available on LinkedIn Learning, try Codeacdemy’s Learn HTML class. This online course will start with the basic structure and elements of HTML. You can then put your knowledge to the test by building out more complex elements and projects, including HTML tables and forms, from scratch.

        While you can complete most of the course for free, there are pro features like quizzes and projects that you’ll have to pay to unlock.

        W3C offers a range of training materials for HTML and CSS. While these tutorials aren't interactive, they're jammed-packed with information relevant to both beginner-level and advanced developers.

        Don't worry about the interactivity of the courses, as W3C provides a reference page that breaks down the material week by week. In week one you're learning the basics of HTML and its syntax then by week four you're off creating stylesheets and building full sections for your web page.

        Learn HTML is a free interactive tutorial. However, rather than try to be the most comprehensive resource on HTML, Learn HTML offers a short step-by-step guide for building out a web page. At every step, you can test whether you understood the lesson by completing an exercise in the online code editor. If your code matches the expected output, then you’ll get a success message and be invited to move onto the next lesson.

        HTML Dog created an HTML Beginner Tutorial for those who have absolutely no previous knowledge of HTML or CSS. It starts with a general overview of what HTML is and what it’s made of (tags, elements, and attributes). Then it walks through how to build out an HTML file with titles, paragraphs, headings, and other elements. By the end, you’ll have walked though how to create a complete HTML file.

        This is similar to W3Schools and Learn HTML — but it invites you to build out the HTML file in your editor of choice, instead of a built-in one. It specifically recommends Notepad.

        The HTML spec by W3C is the living standard for HTML. While it’s not the easiest introduction to the topic, it is the most comprehensive. That’s why we recommend checking it out once you’ve gone through some courses or tutorials and have established some familiarity with web technologies.

        HTML is the language we use to talk to computers. It is how browsers display text, images, paragraphs, and other elements on a web page.

        As such, HTML is the predominant language of the World Wide Web. That makes the language important not only to people trying to become programmers, but to marketers like yourself. Knowing the basics of this markup language will allow you to make changes to your website without needing to rely on a developer, saving you and your business time and money.

        [0]
        Edit
        Query
        Report
        Vipin brpbdl
        EXPEDITER CLERK
        Answer # 4 #

        A simple text editor is all you need to learn HTML.

        Web pages can be created and modified by using professional HTML editors.

        However, for learning HTML we recommend a simple text editor like Notepad (PC) or TextEdit (Mac).

        We believe that using a simple text editor is a good way to learn HTML.

        Follow the steps below to create your first web page with Notepad or TextEdit.

        Windows 8 or later:

        Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad.

        Windows 7 or earlier:

        Open Start > Programs > Accessories > Notepad

        Open Finder > Applications > TextEdit

        Also change some preferences to get the application to save files correctly. In Preferences > Format > choose "Plain Text"

        Then under "Open and Save", check the box that says "Display HTML files as HTML code instead of formatted text".

        Then open a new document to place the code.

        Write or copy the following HTML code into Notepad:

        Save the file on your computer. Select File > Save as in the Notepad menu.

        Name the file "index.htm" and set the encoding to UTF-8 (which is the preferred encoding for HTML files).

        Open the saved HTML file in your favorite browser (double click on the file, or right-click - and choose "Open with").

        The result will look much like this:

        With our free online editor, you can edit the HTML code and view the result in your browser.

        It is the perfect tool when you want to test code fast. It also has color coding and the ability to save and share code with others:

        Click on the "Try it Yourself" button to see how it works.

        If you want to create your own website and save your code online, try our free website builder, called W3schools Spaces:

        [0]
        Edit
        Query
        Report
        Tomoko Tanaka
        Barker
        Answer # 5 #
        • Step 1: Open Notepad (PC) Windows 8 or later: .
        • Step 1: Open TextEdit (Mac) Open Finder > Applications > TextEdit.
        • Step 2: Write Some HTML.
        • Step 3: Save the HTML Page.
        • Step 4: View the HTML Page in Your Browser.
        [0]
        Edit
        Query
        Report
        Amal Bangriwala
        SAILOR PLEASURE CRAFT