Blog

5 Essential Basic HTML Rules for Beginners

The HTML markup language provides a backbone for web developers or business owners working on their own sites or their CMS. Especially if you add CSS and JavaScript, learning HTML means you will have a solid foundation for building and redesigning websites.

Before you begin building your page, you’ll need to decide on a basic layout. To do this, sit down with some old-fashioned paper and a pencil and start sketching, blocking out the page’s elements. You may be itching to get coding, but by drawing your site out first, you can rearrange designs to your heart’s content without coding and recoding.

Once you’ve settled on the organization of your site, it’s time to begin creating your pages with HTML tags – the instructions that surround material such as text, images, and links to other pages and tell the viewer’s web browser how to display them. If you want an image to show up on the left side of the page, a certain word to appear bold, or another word to link to an outside resource, you’ll use HTML tags to do it.

Five rules for coding With HTML tags

There are five important rules for coding with HTML tags.

  1. Tags are always surrounded by angle brackets (less-than/greater-than characters), as in .
  2. Most tags come in pairs and surround the material they affect. They work like a light switch: the first tag turns the action on, and the second turns it off. (There are some exceptions. For instance, the
    tag creates a blank line and doesn’t have an “off switch.” Once you’ve made a line break, you can’t unmake it.)
  3. The second tag–the “off switch”–always starts with a forward slash. For example, you turn on bold with , shout your piece, and then return to regular text with .
  4. First tag on, last tag off. Tags are embedded, so when you start a tag within another tag, you have to close that inner tag before closing the outer tag. For instance, the page will not display properly with the tags in this order:
    </code>Your text<code/>.<br />The correct order is:<br /><code><title/></code>Your text<code/>.</li> <li>Many tags have optional <em>attributes</em> that use values to modify the tag’s behavior. The <code/> (paragraph) tag’s <code>ALIGN</code> attribute, for instance, lets you change the default (left) paragraph alignment. For example, <code/> centers the next paragraph on the page.</li> </ol> <p>Remember, too, that HTML is always evolving, and older browsers often don’t support the newest tags. When a browser encounters an HTML tag it doesn’t understand, it will usually ignore both the tag and the material it affects. This way, the newest elements will appear to viewers with newer browsers without causing problems for viewers using older browsers, who will only see material their browsers recognize. On the downside, browsers treat coding errors like unfamiliar code. If you’ve made a mistake while building your page, you won’t necessarily see an error message; you might just see nothing at all.</p> <p><strong>SEE: Get answers to real-world questions from fellow web developers in the TechRepublic forums.</strong></p> <p>You should always closely check all of your pages in a browser to make sure everything that’s supposed to be there appears properly. We recommend looking at your pages in more than one version of Google Chrome, Microsoft Edge, and Apple’s Safari — on both PC and Mac platforms and mobile devices, if possible — to make sure everything looks how you intended. Not every browser type or version behaves the same way.</p> <h2><span class="ez-toc-section" id="What_are_the_10_basic_HTML_tags"/>What are the 10 basic HTML tags?<span class="ez-toc-section-end"/></h2> <p><strong><doctype/></strong> : When crafting an HTML document from scratch, start with . This will tell the browser how your website works. In HTML5, the DOCTYPE will always be html. At the end of your document, close this tag with .</p><div class="stream-item stream-item-in-post stream-item-inline-post aligncenter"><div class="stream-item-size" style=""><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Horizontal Jannah Ads --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4328481509411152" data-ad-slot="9894279071" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script></div></div> <p><strong/> : This tag creates text headings. H1 creates the largest size heading. Heading sizes go from one to six, descending in size. As is the case with most html tags, close the heading tag with a backslash ( in the case of a heading size 1).</p> <p><strong/> : This tag indicates body text.</p> <p><strong/> : This tag indicates a paragraph break. Enclose both the beginning and end of paragraphs to separate them. For example:</p> <p><code></p> <p>This article is an introduction to HTML.</p> <p></code></p> <p>HTML helps format web content.</p> <p><strong><br /></strong> :  <br />creates a line break. You may prefer it over the paragraph tag if you want to separate text with a specific number of lines, as opposed to just one. You don’t have to close <br />. It is essentially a placeholder.</p> <p><strong><i/></strong> : This tag formats font in italics.</p> <p><strong><b/></strong> : This tag formats font in bold.</p> <p><strong></strong> : The <a> element is a bit complicated but very useful. It embeds links. The HTML code for adding links is:</p> <p><code>link text</code></p> <p>Add the URL where indicated, making sure to include the quotation marks. Change the link text to the text you prefer. The result: Clicking on the link text will open the URL.</p> <p><strong><img/></strong> : This tag embeds images. The way this tag is usually used is:</p> <p><code> </code></p> <p>The src attribute directs the browser to the image. If you host an image on your own website or server, you can use the file name as shown above. If not, you can direct the src attribute to a URL instead.</p> <p>The alt attribute holds a place for alternate text. This is important for accessibiity, or when slow internet might prevent the image from loading. Write a short description of the image in the alternate text section, making sure to include the quotation marks.</p> <p>You can change the size of images by adding <code> style </code> within the brackets. This will look like:</p> <p><code> <img decoding="async" src="”url”" alt="”alternatetext”" style="”width:500px;height:600px;”"/></code></p> <p>Here you can adjust the width and height.</p> <p>The <img/> tag does not need to be closed.</p> <p><strong></p> <blockquote/><p></strong> : This tag indents text in order to set it apart, showing the text is a quotation.</p> <p>These are just some of the many tags at your disposal. W3Schools offers a free tutorial for more. Some others are:</p> <p><strong>Text color</strong> can be set with either pre-established color names or color values in RGB, HEX, or HSL. This looks like:</p> <p><strong></p> <table> creates a table. Create rows by using </p> <tr> and populate columns using </p> <td>.</p> <p><strong/> can be used to create a form such as an email submission box.</p> <h2><span class="ez-toc-section" id="How_to_learn_HTML_as_a_beginner"/>How to learn HTML as a beginner<span class="ez-toc-section-end"/></h2> <p>In my experience, the key to learning HTML is knowing what you want to build. From building an entire website to adding some formatting to a blog post or comment, determine how your end goal will benefit from the changes made possible with HTML. From there, experiment with a text editor.</p> <p>A great way to learn about more complicated HTML is to look over the shoulders of other web page creators. If you see a website you like, just view the page’s source to see how it was done. You should never just copy another builder’s design, but most developers do borrow inspiration from other sites. Methods for viewing the source vary by browser, but it’s usually as simple as selecting View Page Source or Source with a right click. Stick with viewing source code on fairly simple sites until you’re more familiar with web building.</p> <p>When viewing source code, you’ll sometimes see organizational comments from the page’s author near the top of (or scattered throughout) the file. These comments are inserted with the <code><comment/></code> or <code><!----></code> tag and often contain useful information for those who view them. For a simple exercise in reading source code, try viewing a well-commented Web page from your browser and then viewing the source code of that page. Compare the two documents side by side, using the author’s comments to match sections of code with the visual elements they represent. You’ll soon be able to zero in on specific lines of code to understand how to achieve individual effects.</p> <p><em>Update information: Megan Crouse updated this 2003 article in 2024.  She has used HTML in CMS tools and social media for decades and referred to W3Schools for help compiling some of the tagging information. The original version of this article was contributed by Fred Dekker and Donald St. John.  Fred Dekker is one of the Founders of The H.E.L.P. Community, an online resource for beginning Webmasters. Donald St. John was the founding Webmaster at PC Games magazine.</em></p> <section class="share"> <span><br /> Share Article<br /> </span></p> </section> <section class="also-see"> <h3> Also Read </h3> </section> <section class="author-info-box"> <figure role="img"> <meta property="image" content="https://secure.gravatar.com/avatar/54e586832df7a603a996bbc73f0d6af9?s=192&d=mm&r=g"/><br /> <img decoding="async" loading="lazy" src="https://secure.gravatar.com/avatar/54e586832df7a603a996bbc73f0d6af9?s=192&d=mm&r=g" alt="Image of Megan Crouse"/><br /> </figure> <div class="byline"> <p> <span class="author" vocab="https://schema.org/" typeof="Person" property="author"><br /> <span property="name"><br /> Megan Crouse </span><br /> </span> </p> <p> Megan Crouse is a writer and editor with nearly a decade of experience in business-to-business news and feature writing. She studied English Literature and Creative Writing at Fairleigh Dickinson University. </p> <div class="author-content-link"> See all of Megan’s content<br /> <span class="arrow-right"><br /> <svg xmlns="http://www.w3.org/2000/svg" width="12" height="11" viewbox="0 0 12 11"> <path d="M11.8538 5.85378L7.35375 10.3538C7.25993 10.4476 7.13268 10.5003 7 10.5003C6.86732 10.5003 6.74007 10.4476 6.64625 10.3538C6.55243 10.26 6.49972 10.1327 6.49972 10C6.49972 9.86735 6.55243 9.7401 6.64625 9.64628L10.2931 6.00003H0.5C0.367392 6.00003 0.240215 5.94736 0.146447 5.85359C0.0526785 5.75982 0 5.63264 0 5.50003C0 5.36743 0.0526785 5.24025 0.146447 5.14648C0.240215 5.05271 0.367392 5.00003 0.5 5.00003H10.2931L6.64625 1.35378C6.55243 1.25996 6.49972 1.13272 6.49972 1.00003C6.49972 0.867352 6.55243 0.740104 6.64625 0.646284C6.74007 0.552464 6.86732 0.499756 7 0.499756C7.13268 0.499756 7.25993 0.552464 7.35375 0.646284L11.8538 5.14628C11.9002 5.19272 11.9371 5.24786 11.9623 5.30856C11.9874 5.36926 12.0004 5.43433 12.0004 5.50003C12.0004 5.56574 11.9874 5.63081 11.9623 5.6915C11.9371 5.7522 11.9002 5.80735 11.8538 5.85378Z"/> </svg><br /> </span> </div> </p></div> </section> <div id="auth-modal" class="auth-modal__wrapper" style="display: none;" data-logged-in="false"> <div id="auth-sign-up" class="auth-modal__card sign-up"> <form id="sign-up-form" action="https://www.techrepublic.com/wp/wp-admin/admin-ajax.php" method="post" data-ajax-action="tr_auth_sign_up" data-next-reload="1" data-next-step="profile"> <p> <svg class="tr-logo" role="img" aria-labelledby="tr-site-logo" viewbox="0 0 500 119"> <use aria-hidden="false" href="#tr-logotype"/> </svg></p> <h3 style="font-size: 1.25rem; margin-bottom:0;">Create a TechRepublic Account</h3> <p> Get the web’s best business technology news, tutorials, reviews, trends, and analysis—in<br /> your inbox. Let’s start with the basics. </p> <p> <label class="sr-only" for="email">Email</label><br /> <input placeholder="Email *" type="text" name="email" class="input" autocapitalize="off" autocomplete="email" required="required"/></p> <p> <label class="sr-only" for="password">Password</label><br /> <input type="password" placeholder="Password *" name="password" autocomplete="new-password" spellcheck="false" required="required" id="sign-up_password"/></p> <p> <label for="country" class="sr-only">Country</label><br /> <select id="country" name="country" class="readonly" required=""><option value="NOTSELECTED">Country *</option><option value="US"><br /> United States </option><option value="AF"><br /> Afghanistan </option><option value="AX"><br /> Aland Islands </option><option value="AL"><br /> Albania </option><option value="DZ"><br /> Algeria </option><option value="AS"><br /> American Samoa </option><option value="AD"><br /> Andorra </option><option value="AO"><br /> Angola </option><option value="AI"><br /> Anguilla </option><option value="AQ"><br /> Antarctica </option><option value="AG"><br /> Antigua And Barbuda </option><option value="AR"><br /> Argentina </option><option value="AM"><br /> Armenia </option><option value="AW"><br /> Aruba </option><option value="AU"><br /> Australia </option><option value="AT"><br /> Austria </option><option value="AZ"><br /> Azerbaijan </option><option value="BS"><br /> Bahamas </option><option value="BH"><br /> Bahrain </option><option value="BD"><br /> Bangladesh </option><option value="BB"><br /> Barbados </option><option value="BY"><br /> Belarus </option><option value="BE"><br /> Belgium </option><option value="BZ"><br /> Belize </option><option value="BJ"><br /> Benin </option><option value="BM"><br /> Bermuda </option><option value="BT"><br /> Bhutan </option><option value="BO"><br /> Bolivia </option><option value="BA"><br /> Bosnia and Herzegovina </option><option value="BW"><br /> Botswana </option><option value="BV"><br /> Bouvet Island </option><option value="BR"><br /> Brazil </option><option value="IO"><br /> British Indian Ocean Territory </option><option value="BN"><br /> Brunei Darussalam </option><option value="BG"><br /> Bulgaria </option><option value="BF"><br /> Burkina Faso </option><option value="BI"><br /> Burundi </option><option value="KH"><br /> Cambodia </option><option value="CM"><br /> Cameroon </option><option value="CA"><br /> Canada </option><option value="CV"><br /> Cape Verde </option><option value="BQ"><br /> Caribbean Netherlands </option><option value="KY"><br /> Cayman Islands </option><option value="CF"><br /> Central African Republic </option><option value="TD"><br /> Chad </option><option value="CL"><br /> Chile </option><option value="CN"><br /> China </option><option value="CX"><br /> Christmas Island </option><option value="CC"><br /> Cocos (Keeling) Islands </option><option value="CO"><br /> Colombia </option><option value="KM"><br /> Comoros </option><option value="CG"><br /> Congo </option><option value="CD"><br /> Congo, DROC </option><option value="CK"><br /> Cook Islands </option><option value="CR"><br /> Costa Rica </option><option value="CI"><br /> Cote D’ivoire </option><option value="HR"><br /> Croatia </option><option value="CU"><br /> Cuba </option><option value="CW"><br /> Curazao </option><option value="CY"><br /> Cyprus </option><option value="CZ"><br /> Czech Republic </option><option value="DK"><br /> Denmark </option><option value="DJ"><br /> Djibouti </option><option value="DM"><br /> Dominica </option><option value="DO"><br /> Dominican Republic </option><option value="TL"><br /> East Timor </option><option value="EC"><br /> Ecuador </option><option value="EG"><br /> Egypt </option><option value="SV"><br /> El Salvador </option><option value="GQ"><br /> Equatorial Guinea </option><option value="ER"><br /> Eritrea </option><option value="EE"><br /> Estonia </option><option value="ET"><br /> Ethiopia </option><option value="FK"><br /> Falkland Islands (Malvinas) </option><option value="FO"><br /> Faroe Islands </option><option value="FJ"><br /> Fiji </option><option value="FI"><br /> Finland </option><option value="FR"><br /> France </option><option value="GF"><br /> French Guiana </option><option value="PF"><br /> French Polynesia </option><option value="TF"><br /> French Southern Territories </option><option value="GA"><br /> Gabon </option><option value="GM"><br /> Gambia </option><option value="GE"><br /> Georgia </option><option value="DE"><br /> Germany </option><option value="GH"><br /> Ghana </option><option value="GI"><br /> Gibraltar </option><option value="GR"><br /> Greece </option><option value="GL"><br /> Greenland </option><option value="GD"><br /> Grenada </option><option value="GP"><br /> Guadeloupe </option><option value="GU"><br /> Guam </option><option value="GT"><br /> Guatemala </option><option value="GG"><br /> Guernsey </option><option value="GN"><br /> Guinea </option><option value="GW"><br /> Guinea-Bissau </option><option value="GY"><br /> Guyana </option><option value="HT"><br /> Haiti </option><option value="HM"><br /> Heard And Mc Donald Islands </option><option value="VA"><br /> Holy See (Vatican City State) </option><option value="HN"><br /> Honduras </option><option value="HK"><br /> Hong Kong </option><option value="HU"><br /> Hungary </option><option value="IS"><br /> Iceland </option><option value="IN"><br /> India </option><option value="ID"><br /> Indonesia </option><option value="IR"><br /> Iran (Islamic Republic Of) </option><option value="IQ"><br /> Iraq </option><option value="IE"><br /> Ireland </option><option value="IM"><br /> Isle of Man </option><option value="IL"><br /> Israel </option><option value="IT"><br /> Italy </option><option value="JM"><br /> Jamaica </option><option value="JP"><br /> Japan </option><option value="JE"><br /> Jersey </option><option value="JO"><br /> Jordan </option><option value="KZ"><br /> Kazakhstan </option><option value="KE"><br /> Kenya </option><option value="KI"><br /> Kiribati </option><option value="KW"><br /> Kuwait </option><option value="KR"><br /> Korea, Republic Of </option><option value="XK"><br /> Kosovo </option><option value="KG"><br /> Kyrgyzstan </option><option value="LA"><br /> Lao People’s Democratic Republic </option><option value="LV"><br /> Latvia </option><option value="KP"><br /> Korea, Democratic People’s Republic of </option><option value="LB"><br /> Lebanon </option><option value="LS"><br /> Lesotho </option><option value="LR"><br /> Liberia </option><option value="LY"><br /> Libyan Arab Jamahiriya </option><option value="LI"><br /> Liechtenstein </option><option value="LT"><br /> Lithuania </option><option value="LU"><br /> Luxembourg </option><option value="MO"><br /> Macau </option><option value="MK"><br /> Macedonia </option><option value="MG"><br /> Madagascar </option><option value="MW"><br /> Malawi </option><option value="MY"><br /> Malaysia </option><option value="MV"><br /> Maldives </option><option value="ML"><br /> Mali </option><option value="MT"><br /> Malta </option><option value="MH"><br /> Marshall Islands </option><option value="MQ"><br /> Martinique </option><option value="MR"><br /> Mauritania </option><option value="MU"><br /> Mauritius </option><option value="YT"><br /> Mayotte </option><option value="MX"><br /> Mexico </option><option value="FM"><br /> Micronesia, Federated States of </option><option value="MD"><br /> Moldova, Republic Of </option><option value="MC"><br /> Monaco </option><option value="MN"><br /> Mongolia </option><option value="ME"><br /> Montenegro </option><option value="MS"><br /> Montserrat </option><option value="MA"><br /> Morocco </option><option value="MZ"><br /> Mozambique </option><option value="MM"><br /> Myanmar </option><option value="NA"><br /> Namibia </option><option value="NR"><br /> Nauru </option><option value="NP"><br /> Nepal </option><option value="NL"><br /> Netherlands </option><option value="AN"><br /> Netherlands Antilles </option><option value="NC"><br /> New Caledonia </option><option value="NZ"><br /> New Zealand </option><option value="NI"><br /> Nicaragua </option><option value="NE"><br /> Niger </option><option value="NG"><br /> Nigeria </option><option value="NU"><br /> Niue </option><option value="NF"><br /> Norfolk Island </option><option value="MP"><br /> Northern Mariana Islands </option><option value="NO"><br /> Norway </option><option value="OM"><br /> Oman </option><option value="PK"><br /> Pakistan </option><option value="PW"><br /> Palau </option><option value="PS"><br /> Palestinian Territory, Occupied </option><option value="PA"><br /> Panama </option><option value="PG"><br /> Papua New Guinea </option><option value="PY"><br /> Paraguay </option><option value="PE"><br /> Peru </option><option value="PH"><br /> Philippines </option><option value="PN"><br /> Pitcairn </option><option value="PL"><br /> Poland </option><option value="PT"><br /> Portugal </option><option value="PR"><br /> Puerto Rico </option><option value="QA"><br /> Qatar </option><option value="RE"><br /> Reunion </option><option value="RO"><br /> Romania </option><option value="RU"><br /> Russia </option><option value="RW"><br /> Rwanda </option><option value="GS"><br /> S. Georgia And S. Sandwich Isles </option><option value="BL"><br /> Saint Barthelemy </option><option value="KN"><br /> Saint Kitts And Nevis </option><option value="LC"><br /> Saint Lucia </option><option value="MF"><br /> Saint Martin </option><option value="VC"><br /> Saint Vincent And The Grenadines </option><option value="WS"><br /> Samoa </option><option value="SM"><br /> San Marino </option><option value="ST"><br /> Sao Tome And Principe </option><option value="SA"><br /> Saudi Arabia </option><option value="SN"><br /> Senegal </option><option value="RS"><br /> Serbia </option><option value="CS"><br /> Serbia and Montenegro </option><option value="SC"><br /> Seychelles </option><option value="SL"><br /> Sierra Leone </option><option value="SG"><br /> Singapore </option><option value="SX"><br /> Sint Maarten </option><option value="SK"><br /> Slovakia </option><option value="SI"><br /> Slovenia </option><option value="SB"><br /> Solomon Islands </option><option value="SO"><br /> Somalia </option><option value="ZA"><br /> South Africa </option><option value="SS"><br /> South Sudan </option><option value="ES"><br /> Spain </option><option value="LK"><br /> Sri Lanka </option><option value="SH"><br /> St. Helena </option><option value="PM"><br /> St. Pierre And Miquelon </option><option value="SD"><br /> Sudan </option><option value="SR"><br /> Suriname </option><option value="SJ"><br /> Svalbard And Jan Mayen Islands </option><option value="SZ"><br /> Swaziland </option><option value="SE"><br /> Sweden </option><option value="CH"><br /> Switzerland </option><option value="SY"><br /> Syrian Arab Republic </option><option value="TW"><br /> Taiwan </option><option value="TJ"><br /> Tajikistan </option><option value="TZ"><br /> Tanzania, United Republic Of </option><option value="TH"><br /> Thailand </option><option value="TG"><br /> Togo </option><option value="TK"><br /> Tokelau </option><option value="TO"><br /> Tonga </option><option value="TT"><br /> Trinidad And Tobago </option><option value="TN"><br /> Tunisia </option><option value="TR"><br /> Turkey </option><option value="TM"><br /> Turkmenistan </option><option value="TC"><br /> Turks And Caicos Islands </option><option value="TV"><br /> Tuvalu </option><option value="UM"><br /> U.S. Minor Outlying Islands </option><option value="UG"><br /> Uganda </option><option value="UA"><br /> Ukraine </option><option value="AE"><br /> United Arab Emirates </option><option value="GB"><br /> United Kingdom </option><option value="UY"><br /> Uruguay </option><option value="UZ"><br /> Uzbekistan </option><option value="VU"><br /> Vanuatu </option><option value="VE"><br /> Venezuela </option><option value="VN"><br /> Viet Nam </option><option value="VG"><br /> Virgin Islands (British) </option><option value="VI"><br /> Virgin Islands (U.S.) </option><option value="WF"><br /> Wallis And Futuna Islands </option><option value="EH"><br /> Western Sahara </option><option value="YE"><br /> Yemen </option><option value="YU"><br /> Yugoslavia </option><option value="ZM"><br /> Zambia </option><option value="ZW"><br /> Zimbabwe </option></select></p> <p> <label class="checkbox" style="text-align:left;"><br /> <input type="checkbox" name="terms" required=""/><br /> <span><br /> By registering, you agree to the Terms of Use and acknowledge the data practices outlined in the Privacy Policy<br /> </span><br /> </label></p> <p> <button type="submit" class="primary-button"></p> <p> <svg width="65px" height="65px" viewbox="0 0 66 66" role="img" aria-labelledby="tr-spinner"> <title id="tr-spinner">Loading

    Sign Up

    * – indicates required fields

Reset Password

Please enter your email adress. You will receive an email message with instructions on how to reset your password.


1

Finish Profile

2

Newsletter Preferences

Welcome. Tell us a little bit about you.

This will help us provide you with customized content.







1

Finish Profile

2

Newsletter Preferences


Source link

Related Articles

Back to top button
close