Computer Class Files
Computer Class Files
Computer Class Files
HTML Elements
An HTML element is a start tag and an end tag with content in between:
<h1>This is a Heading</h1>
HTML Attributes
HTML elements can have attributes
Attributes provide additional information about the element
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
Example Explained
HTML elements are the building blocks of HTML pages.
HTML Documents
All HTML documents must start with a document type declaration: <!DOCTYPE html>.
<head>
<title>Page title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Note: Only the content inside the <body> section (the white area above) is displayed
in a browser.
HTML Headings
HTML headings are defined with <h1> to <h6> tags.
Example
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
HTML Paragraphs
HTML paragraphs are defined with <p> tags:
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML Links
HTML links are defined with <a> tags:
Example
<a href="https://www.w3schools.com">This is a link</a>
HTML Images
HTML images are defined with <img> tags.
Example
<img src="img_w3schools.jpg" alt="W3Schools" style="width:120px;height:150px"
HTML Buttons
HTML buttons are defined with <button> tags:
Example
<button>Click me</button>
HTML Lists
HTML lists are defined with <ul> (unordered/bullet list) or <ol> (ordered/numbered list)
tags, followed by <li> tags (list items):
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
HTML Tables
An HTML table is defined with a <table> tag.
Example
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
Programming HTML
Every HTML element can have attributes.
Attribute Example
id <table id="table01"
class <p class="normal">
style <p style="font-size:16px">
data- <div data-id="500">
onclick <input onclick="myFunction()">
onmouseover <a onmouseover="this.setAttribute('style','color:red')">
1. The browser requests an HTML page. The server returns an HTML file.
2. The browser requests a style sheet. The server returns a CSS file.
3. The browser requests an JPG image. The server returns a JPG file.
4. The browser requests JavaScript code. The server returns a JS file
5. The browser requests data. The server returns data (in XML or JSON).
XHR is a JavaScript object that is used to transfer data between a web browser and a
web server.
XHR is often used to request and recieve data for the purpose of modifying a web page.
Despite the XML and Http in the name, XHR is used with other protocols than HTTP,
and the data can be of many different types like HTML, CSS, XML, JSON, and plain
text.
HTTP
HTTP (HyperText Transfer Protocol) is a set of rules that a server has to follow when it comes
to the transmission of files (images, videos, audio, and other forms of files) through the World Wide Web (WWW). As
a user opens a browser, they are already making use of an HTTP. Basically, it is an application protocol that runs
through the top of the TCP/IP suite of protocols.
Table of contents
1. Functionality
2. Difference between HTTP and [HTTPS](/wiki/https/)
Functionality
The mechanics and concept behind HTTP includes is that files are related to other files through a series of references.
This selection will elicit the additional transmission requests. Any web server device actually contains a program that
is called an HTTP daemon, which is a designed to anticipate HTTP requests and handle them when they arrive. Your
typical web browser is an HTTP client which is constantly sending requests to server devices. The user enters file
requests by going through a web file, which in this case is usually a URL, or click a link; the browser builds up an HTTP
request and then sends it to an IP which is indicated through the URL.
1. The browser would request an HTML page. The server would then return an HTML file from the host 1
2. The browser would request a style sheet. The server then returns a CSS file.
3. The browser requests a JPG image. The server returns a JPG file.
4. The browser would request a JavaScript code (a programming language). The server would then return a JS
file.
5. The browser requests different forms of data. The server returns data in the form of XML or JSON files.
2. This protocol is basically an application layer protocol. What that means is that it focuses more on
information that is being presented towards the user but does not focus on how that data is being
transmitted from the source host towards the recipient. This can become a detriment since this
means of delivery can easily be intercepted and traced by malicious third party users (usually
known as hackers).
1. Compared to HTTP, user information, such as credit card numbers and other forms of important
personal information are encrypted. This stops any form of malicious third party users from
accessing these forms of sensitive data.
2. With a more secure network, users will have a higher level of confidence when using the site since
their data is encrypted and users with malicious intent will have a difficult time hacking into their
data.[3]
1. Statistics show that 84% of shoppers abandon websites once they know that the website
is transferring data through an insecure channel.
2. 29% of users are aware of the difference between HTTP and HTTPS and they actively look
for this difference on the address bar.
3. Being a new form of technology, HTTPS still has a few traits that are still considered experimental.
As such, older types of browsers will have a difficult time adapting to these websites.
4. As compared to just setting up a site with HTTP, transitioning towards HTTPS requires a user to go
through several legal processes in order to acquire an SSL certificate. This means that owners of
pages and sites have to expend money. Obtaining an SSL certificates is a paid service from a
Certificate Authority.
5. Because of the encoding process, the server routes power and processing time towards encoding
the information before it is being transmitted.
HTTP works within the application layer while HTTPS works within the Transport Layer Security (TLS).
There is no SSL certificate that is required for HTTP but HTTPS requires an SSL certificate to be signed and
implemented by a Certification Authority (CA).
HTTP does not necessarily require domain validation while HTTPS mandatorily requires domain validations
and certain certifications which do require a legal process.
There is no data encryption in HTTP while data is being encrypted right before it is being transmitted for the
HTTPS.
HTTPS is an extension of HTTP. In this case, it jointly works together with another protocol, namely Secure
Sockets Layer (SSL) in order to transmit the data safely.
Both HTTP and HTTPS do not address the data will be transmitted towards its target destination. Inversely,
SSL does not have any function whatsoever to do with how the data will appear.
Users often falsely believe that HTTPS and SSL are the same protocols. HTTPS is secure since it uses SSL in order to
transmit data. Currently, SSL is slowly being phased out by TSL since it is an even more secure method of data
encryption that is going to be sent.
1. https://www.w3schools.com/whatis/whatis_http.asp↩︎↩︎
2. https://www.globalsign.com/en/blog/the-difference-between-http-and-https/↩︎
3. https://www.howtogeek.com/181767/htg-explains-what-is-https-and-why-should-i-
care/↩︎
4. https://www.instantssl.com/https-tutorials-ssl-certificates ↩︎
Image: Webopedia's custom "404 File Not Found" (HTTP status code) page.
Related Terms
HTML - HyperText Markup Language
HTTPD - HTTP daemon
HTTP request header
HTTP response header
FTP - file transfer protocol
ICAP - Internet Content Adaption Protocol
Nginx
virtual Web site
Firesheep
REST - Representational State Transfer
HTTPS
Hyper Text Transfer Protocol Secure (HTTPS) is the secure version of HTTP,
the protocol over which data is sent between your browser and the website that you are
connected to. The 'S' at the end of HTTPS stands for 'Secure'. It means all
communications between your browser and the website are encrypted.
HTTPS
Protocol
Description
Hypertext Transfer Protocol Secure is an extension of the Hypertext Transfer Protocol.
It is used for secure communication over a computer network, and is widely used on the
Internet. In HTTPS, the communication protocol is encrypted using Transport Layer
Security or, formerly, its predecessor, Secure Sockets Layer.
Standard port: 443
HTTPS: What It Does, Why You Need It and How to Get It
HTTP has been around since the very beginning of the internet in the late 1980s. You
see it at the beginning of every website URL in your web browser’s address bar, but
what exactly is it?
HTTP, which is short for HyperText Transfer Protocol, is a set of rules for transferring a
web page between a web server and your browser. When you browse to a specific URL
in your browser, it starts a conversation with the website’s server to download
everything it needs to render that web page.
What if your browser needs to send or receive information that is private? The
conversation that takes place with HTTP happens in “plain text” which means a third-
party can listen in on your browser’s conversation and see everything that is being said.
This is a great way to steal personal information like your credit card number or other
sensitive stuff. To discourage this, we need to use HTTPS.
HTTPS is the exact same conversation your browser and the web server were having
before, but now all of that information is encrypted. Only your browser and the web
server possess the key to decrypt it. This prevents any eavesdroppers from
understanding what is being said.
The encryption that happens when you’re using HTTPS is done using a special
“SSL/TLS certificate” from the website’s server as well as a unique encryption key from
your browser. Both the certificate and your key are used throughout your conversation
to prove to the other party that they are who they say they are. Without these, a third-
party could intercept your conversation and pretend to be either the server or your
browser.
Before the conversation begins, your browser and the server say hello and agree on
two things: the type of encryption they are going to use and the encryption keys that are
going to be used to perform the encryption. Once this initial handshake is complete,
both your browser and the server can speak the same encrypted language and can
have a private conversation that is very hard to eavesdrop on.
Despite all of this complicated technology happening behind the scenes, your browser
makes it very easy to make sure HTTPS is on and working properly. In addition to
having “https://” in the URL bar on your browser, you will also see a padlock icon
somewhere nearby indicating that your connection to the website is secure.
If you don’t see that confirmation in your browser, then HTTPS is not active and
everything your browser is sending and receiving is not encrypted. This is actually OK if
you’re just browsing a website without entering in any personal information. However,
you should always make sure HTTPS is active whenever you are performing activities
such as logging into a website, filling out a form, or checking out on an ecommerce site.
This doesn’t actually mean there is a problem with the site, but Google is now taking the
responsibility of warning Chrome users to not enter sensitive information on this site. If
your users are concerned about their privacy, seeing the words “this site is not
secure” does not instill confidence in your website. More and more people are
looking for that little padlock icon to give them peace of mind about their privacy and
security. If they have that, they will trust your website more, and in turn will be more
likely to return.
SEO Boost
Back in 2014, Google shook things up by including HTTPS as a ranking signal for their
search engine. It’s by no means a large factor in your rankings, but it is a small one. It
can come in handy if your site ties with a competitor on every other ranking signal
because if you have HTTPS you will rank higher. If you’re competing for some major
search keywords, it’s almost irresponsible not to have HTTPS.
Website Performance
A great side-effect of using HTTPS, if you are on the right web host, is that your website
will get a nice performance boost. There is a new technology on the web called HTTP/2.
Without going into a lot of detail, this technology is the new protocol your web browser
can use to connect to web servers. The current HTTP protocol (HTTP 1.1) was created
over 15 years ago. Since then, websites have become dramatically more complex.
Instead of a single HTML document and a few images, your average web page will
have dozens of images, several stylesheets and JavaScripts, and will load a few
external APIs like Facebook, a live chat, etc. HTTP/2 was built with the modern web in
mind and dramatically speeds up the connections between your browser and the web
server resulting in a much faster page load time. Check out this fun demonstration of
HTTP vs. HTTP/2 and see for yourself!
So where can you get HTTP/2? The good news is that all modern web browsers
support it, but they also require that the website is using HTTPS in order for it to work.
The bad news is that you need to have a web host that supports HTTP/2.
WP Engine is an ideal host because they support HTTP/2 and requires almost no effort
to set up. By simply installing an SSL certificate, HTTP/2 immediately turns on and
you’re ready to go. There are other hosts out there that support it and they can be found
by a simple search for “http/2 web hosts.” If you are stuck on a web host that doesn’t
support it, you can use a third-party service like CloudFlare. Their service will handle
serving up your website’s content via HTTP/2 but your web host still hosts and runs the
site itself.
Despite all of the awesome that HTTPS gives you, there can be some risks to making
the switch if you’re not prepared.
Temporary Drop in Traffic
If you have an existing site using HTTP and you switch to HTTPS, Google counts this
as a site move. That brings with it the usual SEO penalties that comes with it. However,
you can mitigate the effect by adding your HTTPS site to Google Search Console and
Bing Webmaster Tools. After making the switch, Google specs SEO recovery time from
a few weeks (likely) to 2–3 months (less likely).
Duplicate Content and Link Dilution
Because switching from HTTP to HTTPS counts as a site move, you will need to make
sure only one version of your site (the HTTPS version) is active. This can be done by
taking the following steps:
Use 301 redirects — Anytime you permanently move content, you need to set up a 301
redirect for search engines. For the HTTP to HTTPS switch, just one rule in your
.htaccess file should take care of it.
<IfModule mod_rewrite.c>
If editing your website’s files isn’t something you’re comfortable with, there are plugins
for all the major CMSs that will do this for you.
Update your sitemap — Make sure your XML sitemap is only using HTTPS URLs.
If your site uses a CMS and has an SEO plugin installed, it should take care of this for
you if your CMS is configured with an HTTPS URL.
Ensure all internal links point to your HTTPS URL — Any internal links on
your website will need to be using the HTTPS version. If your site uses a CMS like
Drupal, it uses relative URLs in its content and will automatically update. If you’re using
WordPress which uses absolute URLs in its content, you’ll need to do a search and
replace of your database to change all HTTP URLs to HTTPS.
Ensure canonical tags point to your HTTPS URL — The rel=canonical tag on
all of your site’s pages must point to the HTTPS versions. A CMS website with an SEO
plugin should take care of this automatically.
Ensure external links to your site point to your HTTPS URL — This one is
more tricky since you obviously won’t have the ability to change all the external links to
your website. However, you should change the ones that you do have access to, such
as within social profiles. It’s not worth the effort to pester other website owners to
update their links to your site. After all, that’s what the 301 redirect is for.
Beware of Mixed Content
It’s very satisfying to see that nice green padlock icon in your browser when HTTPS is
up and running on your site. However, it only takes one single piece of your site that is
not loading via HTTPS to change that.
For example, if your site is set up 100% correctly for HTTPS and you decide to embed a
YouTube video in a blog post, you must make sure you use YouTube’s HTTPS URL for
the video. Otherwise, the video loads over HTTP and the browser will see this,
triggering a “mixed content error.” Chrome shows this by switching from the padlock
icon to an information icon and saying your site “is not fully secure.”
If you find it frustrating to constantly make sure you’re using HTTPS URLs in your
website’s content, there are plugins available for the major CMSs that will “force” all
URLs to be HTTPS. That means if an HTTPS version of the URL exists, it will switch to
it. However, you should still be vigilant in case you embed content from a provider that
doesn’t have an HTTPS version.
HTTPS only works if your SSL certificate is valid and active, so you must keep track of
the expiration date on your certificate. If you let it expire, HTTPS will break and the
browser will display a big scary warning to everyone visiting your
site.
This won’t do any good in terms of establishing trust between you and your users. You
must always make sure your certificate is renewed annually.
You can set up auto-renewals with your certificate issuer, but you (or your developer)
are still required to install the renewed certificate in your server. If you can’t do this, then
try to pick a web host that auto-renews and auto-installs certificates for you. That way
you will always ensure your certificate is OK.
Now that you’re an expert on what HTTPS is, how it works, and the pros and cons, how
do you actually get started with using it?
Purchase a Certificate
The first step is to purchase the SSL certificate for your site. Often times, your web host
will be the easiest place to get a certificate from. If they don’t offer their own SSL, some
reputable certificate issuers include DigiCert, VeriSign, and GeoTrust. For the budget
conscious, GoDaddy and Namecheap have the most affordable options.
Always make sure you are buying a certificate that is “SHA-2”, also referred to as “2,048
bit”. This represents the strength of the encryption and is currently the industry
standard.
Next, you will be faced with a menu of certificate options. Depending on the certificate
issuer, you could be faced with two or three certificate options or sometimes a dozen.
So which option is the one you need? All of them can be broken down into just a few
certificate types:
Domain Validation
This is the most common type of certificate. It validates that you have the right to use
your domain name. This is probably the one you’ll want.
Organization Validation
In addition to validating your domain name, this type of certificate will also validate the
existence of your company or organization. Some company details will also be
displayed in your public certificate information to pass along that trust to the website
user.
Extended Organization Validation
This type will go even further with the process of validating your company or
organization. This will involve actual paperwork and processing. They will verify the
legal, physical, and operational existence of the company, among other things. You will
also get extra-special treatment by people’s web browsers, displaying your company’s
name in a lovely shade of green next to the secure padlock
icon.
Wildcard
If you have multiple subdomains that you use for different websites, products, etc. then
a wildcard certificate may be best. Instead of buying a certificate for every single
subdomain, a single wildcard certificate will take care of the job. This will save a lot of
money.
Multi-Domain
These are also known as “Subject Alternative Name” (SAN) certificates or a “Unified
Communication Certificate” (UCC). This is an option from some issuers that let you use
one certificate on multiple domain names. This is different from a wildcard which only
works on one domain name and is designed for subdomains.
Free SSL Certificates
Yes, this is really a thing! Created by organizations that believe in “HTTPS everywhere”,
there are a few issuers that will give you a domain validated certificate for free. Let’s
Encrypt is a great example. The only problem is that if you’re not a developer, these can
sometimes be difficult to set up. However, there are web hosts out there that have
included a free SSL option in their plans. WP Engine, A2 Hosting, and Dreamhost are
examples. Just do a search for “free ssl web hosting”. Free certificates are a major leap
forward in the goal towards making the web a more secure place.
No matter what level of validation or type of certificate you choose, always remember
that there is absolutely no difference in the level of security or encryption. You can use a
free certificate or pay hundreds of dollars and your users’ data will be just as secure as
long as they are using SHA-2 encryption. By paying extra for more validations, you’re
getting a more trustworthy stamp of approval on your certificate due to how heavily your
website and company have been vetted.
WHAT IS THE WWW PART OF A URL CALLED?
What are the 5 parts of a URL?
A URL consists of five parts -- the scheme, subdomain, top-level domain, second-level
domain, and subdirectory.
The first part of the URL is called a protocol identifier and it indicates what protocol to use, and
the second part is called a resource name and it specifies the IP address or the domain name
where the resource is located. The protocol identifier and the resource name are separated by a
colon and two forward slashes.
URL is the abbreviation of Uniform Resource Locator and is defined as the
global address of document and other resources on the World Wide Web. To visit this
website, for example, you'll go to the URL www.webopedia.com.
We all use URLs to visit webpages and other resources on the web. The URL is an
address that sends users to a specific resource online, such as a webpage, video or
other document or resource. When you search Google, for example, the search results
will display the URL of the resources that match your search query. The title in search
results is simply a hyperlink to the URL of the resource.
A URL is one type of Uniform Resource Identifier (URI); the generic term for all types of
names and addresses that refer to objects on the World Wide Web.
What Are the Parts of a URL?
The first part of the URL is called a protocol identifier and it indicates what protocol to
use, and the second part is called a resource name and it specifies the IP address or
the domain name where the resource is located. The protocol identifier and the
resource name are separated by a colon and two forward slashes.
For example, the two URLs below point to two different files at the
domain webopedia.com. The first specifies an executable file that should be fetched
using the FTP protocol; the second specifies a webpage that should be fetched using
the HTTP protocol:
ftp://www.webopedia.com/stuff.exe
http://www.webopedia.com/index.html
Accessing a URL that ends in .com, .html, or .htm will display a webpage located at that
address. If, for example, you visit a URL that ends in .jpg or .png you can expect to view
an image file.
Web Address is a URL with HTTP/HTTPS
The term "web address" is a synonym for a URL that uses the HTTP or HTTPS
protocol. The Uniform Resource Locator (URL) was developed by Tim Berners-Lee in
1994 and the Internet Engineering Task Force (IETF) URI working group. Today, the
format of the URL has not changed. The URL format is specified in RFC 1738 Uniform
Resource Locators (URL).
In Programming: The URL Class
Note that in object-oriented programming, such as Java, programs can use a class (a
category of objects) called URL. You can create a URL object to represent the URL
address.
Recommended Reading: See Java Tutorials: Working with URLs in the Related Links
section below for additional information on using the URL object in a Java program.
Related Terms
Internet address
IP address - Internet Protocol (IP) address
virtual IP address
loopback address
address
martian address
static NAT
APIPA - Automatic Private IP Addressing
address bar spoofing
ARP - Address Resolution Protocol
What are the different parts of URL explain with example?
A URL usually consists of the following components:
Protocol – the method used to process the URL eg. http or https.
Domain – the domain name eg. ...
Path – the section and page on the site.
Hash – identifies a section within the page.
Query String – key/value parameters containing dynamic data passed to the page.
What is a URL made up of?
A basic URL will consist of three parts, or substrings, separated by defining characters.
These include the protocol, the host name or address, and the resource location. A
simple example of a URL string would take the following form:
http://www.example.com/index.html.
How do I create a URL?
Create a short URL
The HTTP 1.1 spec defines an Hypertext Transfer Protocol (HTTP) Method Registry. As
of 2017-01, shows 39 entries:
ACL
BASELINE-CONTROL
BIND
CHECKIN
CHECKOUT
CONNECT
COPY
DELETE
GET
HEAD
LABEL
LINK
LOCK
MERGE
MKACTIVITY
MKCALENDAR
MKCOL
MKREDIRECTREF
MKWORKSPACE
MOVE
OPTIONS
ORDERPATCH
PATCH
POST
PRI
PROPFIND
PROPPATCH
PUT
REBIND
REPORT
SEARCH
TRACE
UNBIND
UNCHECKOUT
UNLINK
UNLOCK
UPDATE
UPDATEREDIRECTREF
VERSION-CONTROL
HTTP 1.0
HTTP 1.1 is officially defined in RFC 2068. This spec added five more methods.
OPTIONS
…a request for information about the communication options available on the
request/response chain… determine the options and/or requirements associated
with a resource, or the capabilities of a server, without implying a resource action or
initiating a resource retrieval
PUT
…requests that the enclosed entity be stored under the supplied Request-URI. If …
already existing resource, the enclosed entity SHOULD be considered as a modified
version of the one residing on the origin server…
DELETE
…delete the resource identified by the Request-URI…
TRACE
…loop- back of the request message…
CONNECT
…for use with a proxy that can dynamically switch to being a tunnel (e.g. SSL
tunneling…
HTTP Extensions
PATCH
Applies partial modifications to a resource
Defined by RFC 5789
WebDAV specifies seven more methods:
PROPFIND
PROPPATCH
MKCOL
COPY
MOVE
LOCK
UNLOCK
HTTP/2
An HTML tag is a special word or letter surrounded by angle brackets, < and >. You use
tags to create HTML elements, such as paragraphs or links.
Many elements have an opening tag and a closing tag — for example, a p (paragraph)
element has a <p> tag, followed by the paragraph text, followed by a closing </p> tag.
Some elements don’t have a closing tag. These are called empty elements. For
example, the br element for inserting line breaks is simply written <br>.
If you’re working with XHTML then you write empty elements using self-closing tags —
for example, <br />.
The html
element sits at the root of the tree of elements in a web page.
To create the html element, you write an opening <html> tag followed by a
closing </html> tag. Everything else in your web page then goes between these 2
tags:
<html>
</html>
The head element contains information about the web page, as opposed to the web
page content itself. There are many elements that you can put inside the head element,
such as:
title (described below)
link, which you can use to add style sheets and favicons to your page
meta, for specifying things like character sets, page descriptions, and keywords
for search engines
script, for adding JavaScript code to the page
Here’s a typical head element:
<head>
</head>
The title element contains the title of the page. The title is displayed in the browser’s
title bar (the bar at the top of the browser window), as well as in bookmarks, search
engine results, and many other places.
The title should describe the page’s content succinctly and accurately. Try to give each
page of your site its own unique title.
Here’s an example:
The body element appears after the head element in the page. It should contain all the
content of your web page: text, images, and so on. All web pages have 1
single body element, with the exception of frameset pages, which
contain frame elements instead.
<body>
</body>
Headings let you break up your page content into readable chunks. They work much
like headings and subheadings in a book or a report.
6. <p> … </p> — A paragraph
The p element lets you create paragraphs of text. Most browsers display paragraphs
with a vertical gap between each paragraph, nicely breaking up the text.
While you can create “paragraphs” of text just by using <br> tags to insert blank lines
between chunks of text, it’s better to use p elements instead. Not only is it neater, but it
gives browsers, search engines and other non-humans a better idea of how your page
is structured.
A good rule of thumb when writing text for the web is to make sure that each paragraph
contains a single point, topic or thought. If you want to talk about 2 different things, use
2 paragraphs.
7. <a> … </a> — A link
One of the most important elements in a web page, the a element lets you create links
to other content. The content can be either on your own site or on another site.
To create a link, you wrap <a> and </a> tags around the content you want to use for
the link, and supply the URL to link to in the <a> tag’s href attribute.
8. <img> — An image
The img element lets you insert images into your web pages. To insert an image, you
first upload the image to your web server, then use an <img> tag to reference the
uploaded image filename. Here’s an example:
<img src="myphoto.jpg" alt="My Photo">
The alt attribute is required for all img tags. It’s used by browsers that don’t display
images to give alternative text to the visitor.
The div element is a generic container that you can use to add more structure to your
page content. For example, you might group several paragraphs or headings that serve
a similar purpose together inside a div element. Typically, div elements are used for
things like:
Here’s an example that uses a div to contain the content for a sidebar in the page:
<div id="sidebar">
<h1>Sidebar Heading</h1>
<p>Sidebar text</p>
</div>
10. <span> … </span> — An inline container for content
The span element is similar to div in that it’s used to add structure to your content. The
difference is that div is a block-level element, while span is an inline element:
Block-level elements, such as div, h1, and p, are elements that are designed
to hold relatively large or stand-alone blocks of content, such as paragraphs of
text. A block-level element always starts on a new line.
Inline elements, such as span, a, and img, are designed to hold smaller pieces
of content — such as a few words or a sentence — within a larger block of content.
Adding an inline element doesn’t cause a new line to be created. Block-level
elements can contain inline elements, but inline elements can’t contain block-level
elements.
As with a div, you often add a class and/or id attribute to a span so that you can
style it using CSS.
Now that you’ve learned these 10 essential HTML tags, let’s put them all together in a
single web page:
<html>
<head>
<title>The Adventures of My Cat Lucky</title>
</head>
<body>
<div id="mainContent">
</div>
<div id="sidebar">