Web Technologies PDF
Web Technologies PDF
• This is a generic term used to describe a collection of tools that are used to plan, design,
develop and deploy state-of –the-art websites and web applications.
• There are quiet a number of web technologies in use today by professional web
developers.
Some Popular Web Technologies
The following web technologies are very relevant in the development of modern day websites
and web applications.
– HTML
– CSS
– JavaScript
– PHP
– WordPress
– Angular
– Bootstrap
– ReactJS
– Laravel
– MongoDB
– Node.js
SGML
• SGML stands for Standard Generalized Markup Language.
• SGML is a system(ISO standard) used to specify document structure.
• It was originally developed as part of the IBM document-sharing project in 1974 and
became an official ISO standard in 1986.
• Most markup languages such as HTML and XML are derived from SGML.
HTML
• HTML stands for HyperText Markup Language.
• HTML is a language, which makes it possible to present information on the Internet.
• That is, web pages all over the world consist of HTML.
• However, HTML is not a programming language but a markup language.
Focus Questions?
• Explain the following:
– Web page
– Index page
– Web site
– Web browser
– Web application
• Briefly describe how you would register for a domain name.
• Write down any 10 web hosting companies you know of
• Provide the full meaning of the following acronyms as applied in web technologies
– ICANN, JSON, AJAX, RSS, URI, XSLT
Web Browsers
• A web browser is an application software for accessing, traversing, retrieving, and
rendering information resources on the world wide web.
• A web browser can also be defined as an application software or program designed to
enable users to access, retrieve and view documents and other resources on the web.
• Although browsers are primarily intended to use the World Wide Web, they can also be
used to access information provided by web servers in private networks or files in file
systems.
• The major web browsers are: Chrome, Firefox, MS Edge, Opera, and Safari.
Browser Architecture
• The web browser architecture consist of eight major subsystems and the relationships that
exist between them:
1. The User Interface lies between the user and the browser engine.
• This includes the address bar, back/forward buttons, bookmarking menu etc.
• Basically every part of the browser display except the main window where you see the
requested page.
2. The Browser Engine: it’s the core software components of every major browser.
• its to transform HTML documents and other resources of the web page into an
interactive visual representation.
• subsystem provides an interface for the rendering engine.
• It is responsible for loading a given URI and supports browsing actions such as forward,
back, refresh/reload.
• It makes querying and manipulation of rendering engine settings possible.
3. The Rendering Engine: Its specifies web pages requested by the user on their screen.
subsystem is responsible for the visual representation of URI inputs.
• It interprets and displays HTML and XML documents, including embedded contents
(e.g. images, videos) if there are any.
• It is responsible for positioning of page elements within the page and sets up the page
layout. It includes the HTML parser.
4. Networking subsystem is where file transfer protocols FTP, SMTP and HTTP are
enforced.
• It resolves MIME(Multipurpose Internet Mail Extensions) types of files.
5. JavaScript Interpreter assesses Java scripts which may be embedded in web pages.
• Some JavaScript functionalities include pop up windows and these may be
blocked/disabled by the browser engine or rendering engine for security purposes.
6. The XML Parser subsystem is one of the most reusable subsystems in the architecture.
• Almost all browser implementations enforce an existing XML Parser rather than building
their own from scratch.
• The Display Backend subsystem offers drawing and windowing primitives, a set of user
interface widgets, and a set of fonts. May be tied closely to the OS.
• 8. The Data Persistence subsystem stores various data associated with the browsing
session on disk.
• This may be high-level data such as bookmarks or toolbar settings, or it may be low-level
data such as cookies, security certificates, or cache.
Web Servers
• A Web server can refer to either the hardware (the computer) or the software (the
computer application) that helps to deliver web contents that can be accessed through the
Internet.
• The most common use of web servers is to host websites, but there are other uses such as
data storage or running enterprise applications.
• The primary function of a web server is to deliver web pages on the request to clients
using the Hypertext Transfer Protocol (HTTP).
• Some of the major web servers are:
– Apache
– Nginx
(pronounced, "engine-x")
– Apache Tomcat
– IIS
– Jigsaw
– Lighttpd
(pronounced, “lighty”)
– Klone.
– Zeus.
What is Application Server?
The Web Design Process
• Designing a web site goes through a series of steps refer to as the Web design process.
• The exact order in which the process is carried varies from organization to organization,
and developer to developer.
Phases of the Web Design Process
• The phases of the web design process include the following steps.
1. Project Definition
2. Project Scope
3. Site Architecture
4. Visual Design
5. Site Development
6. Site Testing
7. Launching
8. Site Maintenance
Project Definition
• Organizations have a need to communicate to stakeholders their positions on issues and
make audiences aware of their products and services.
• Many times the communication need, such as a web site, is triggered by a change of
strategic direction or a new offering.
• Identifying the reasons of the site’s existence and what it is supposed to achieve are the
first step in the process.
• The goals and objectives that are established at the outset of the project inform all future
decisions, from site structure and naming conventions used in the navigation to the visual
design of the site.
• The first step in the definition process is interviewing the organization’s stakeholders to
identify the strategic goals of the site, understand key audience needs and identify key
competitors.
• The goal of the definition step is to identify three measurable key outcomes that are
directly related to the strategic goals of the organization.
• The challenge in this step is limiting the number of goals.
• Most organizations will have more goals than they know what to do with, and each
department believes their individual unit’s goals are the most important.
• Being able to bring focus to organizational goals will make developing the site easier and
make the final product more effective.
• Once all the information and assessments gathered from the stakeholder interviews are
completed, they should be collected in a well-formatted project brief.
• The brief contains the following elements.
1. Project summary: Outlines the general overview of the project, organizational
background, the environment the organization exists in, the people the organization
serves and the unique value it provides to its audience.
2. Goals: What are two or three specific measurable goals that the site should achieve?
Clear goals allow the Web team the ability to focus on what will provide the most impact
and move the organization forward.
3. Target audiences: Who will help the organization achieve its stated goals? Most
organizations speak to customers, stakeholders, internal audience, suppliers, partners, or
government institutions.
4. Messages: What are the key messages that attract and motivate key audiences to engage
with the organization? What are the key brand messages that help differentiate the
organization from its peers?
5. Competition: Who are rival organizations that provide similar offerings to your
audience? Include an overview of competitive organizations’ web sites, considering
visual branding, messaging, navigation, calls to action and key differentiators.
Project Scope
• Defining the scope of the project is a critical step.
• One of the most common frustrations with web, and other information system projects is
scope creep.
• By creating a well-defined project scope plan that outlines specific activities and
deliverables, along with specific timelines, you will be able to clearly set expectations for
your clients.
• One of the most common ways of tracking Web projects is through the use of a Gantt
chart.
• A Gantt chart not only outlines major activities but also the tasks associated with each
activity and start and end dates.
• The Gantt chart provides a visual reference for the team, showing the timeframe of each
step and the dependencies between steps.
• The Gantt chart also creates accountability between the Web team and the client (which
could be an outside client or simply your boss), letting the client and the team know that
the delivery schedule is dependent on everyone hitting their marks; if someone misses a
date by a day, the entire schedule shifts by a day.
Site Architecture
• Site architecture includes the sitemap and wireframes of pages.
• Creating the sitemap ensures that you’ve considered all the key pages in the site, showing
their relationship to each other and defining how the sites overall navigation should be
structured.
• Wireframes provide a detailed view of the content that will appear on each page.
• Although they do not show any actual design elements, the wireframes provide a guide
for defining content hierarchy on the page.
• A good web design requires a solid site architecture based on the site's goals and target
audience established in the project brief.
• The deliverables from this phase are:
• Content Outline
• Site Diagram
• Wireframes / Page Description Diagrams
• These three deliverables need to be completed sequentially.
Site Structure – Content Outline
• Working closely with your clients, create a list of all existing content.
• Brainstorm content that needs to be created for the site.
• Review the list of content, trimming anything that does not match the goals or audience
needs as stated in the project brief.
• Take time to think about the future and how the site content might need to grow.
• Make sure you leave room for growth.
• Next group your content into categories.
• Once your categories are established, create an outline of your content and review it with
your clients for accuracy.
Site Structure – Site Diagram
• Take your final content outline and create a sitemap or site diagram.
• A site diagram is just a visual representation of your content outline and site structure.
• You can use MS Word, Visio or other relevant tools to create your site diagram.
Site Structure - Wireframe
• A wireframe is usually a non-graphical layout of a web page.
• It is a simple drawing of the chunks of information and functionality for each page in
your site. You will want to create a wireframe for the home page, each unique second
level page and any other significantly different page on the site.
• Wireframes include the containers for all the major elements of the page.
• Elements include navigation, images, content, functional elements (like search) and
footer.
Visual Design
• Once the blueprint for the site has been defined through the creation of the sitemap and
wireframes, the next step is to create a visual style.
• The overall visual style will most likely be determined by the visual brand of the
organization; the goal being to connect the Web with all other forms of the organization’s
communications.
• The organization’s brand plays an important role in this part of the process, as designers
will want to visually convey key brand perceptual ideas within the design.
Site Development
• With designs approved, it’s time to flesh out the design of the pages, develop new content
and refine old content, create videos, slideshows, podcasts and other media that will
appear on the site as well as start to build out the HTML and CSS of the site.
Site Testing
• Before the site is launched, it will be placed on a production server where only internal
audiences and anyone who you share the link with can view it.
• Testing of the site is critical as there will inevitably be issues that need to be addressed
before the site goes live.
• There is nothing that erodes a brand more than a site that doesn’t function properly or that
has misspellings or broken design elements.
• At this stage the site will need to be reviewed on multiple browsers (Firefox, Safari,
Internet Explorer) and multiple devices (laptops, tablets, and mobile) to see if and where
breaks occur.
Launching the Site
• Once the site is reviewed and approved by the project stakeholders, then you are ready to
launch and make it known to the world.
• Register a domain
• Find a hosting company
• Upload the website
• But once the site is launched, the project isn’t over.
• Be prepared to address feedback from users adapting to the new site.
• Expect to make some immediate changes to the site, such as fixing broken links, editing
content and making adjustments.
• Note that the Web is a fluid medium that changes on a daily, if not hourly basis —
change is inevitable.
Site Maintenance
• Just like any other information system, websites constant care and maintenance.
• Updating content, making changes to the backend and fixing broken links are all in a
day’s work.
• All of these phases are critical to the Web design process.
• A proper maintenance strategy must therefore be put in place for your website projects.
• This will help organizations achieve a goal, move forward, and prosper in a competitive
environment.
Focus Questions
• What are the key functions of web browsers and web servers.
• In your own perspective, describe what you think should constitute the process of
developing a website.
• Outline the steps you would take in hosting your website with a hosting company
• Assume you want to setup your own web hosting company, outline key skillsets, and
resources you may need
Overview of HTML
• HTML stands for HyperText Markup Language.
• The idea behind HTML was born at the European Laboratory for High Energy Physics
(CERN) in Geneva, Switzerland, as early as 1989 .
• A year later, the World Wide Web project was also started there.
• The purpose was to make it easier for scientists at different universities and research
laboratories to gain access to research documents of their colleagues .
• An HTML document is simply a text file(may also contain images, video or audio) that
contains the information you want to publish and the appropriate markup instructions
indicating how the browser should structure or present the document.
• Markup elements are made up of a start tag, such as <p>, and typically, though not
always, an end tag, which is indicated by a forward slash within the tag, such as </p>.
• The tag pair should fully enclose any content to be affected by the element, including text
and other HTML markups.
HTML Elements and Tags
• An HTML element consists of both the content and its markup.
• A tag consists of the element name(usually an abbreviation of a longer descriptive name)
within angle brackets( < > ).
• The element name appears in the opening or start tag and again in the closing or end tag
preceded by a forward slash(/).
• The tags added around contents are referred to as the markup.
• It is important to note that an element consists of both the content and its markup(the start
and end tags).
• Elements that have content are referred to as Containers. e.g <p>some text</p>
• However, not all elements have content, and these are referred to as Empty elements.
e.g <input type=“text” name=“textbox” />
<input type=“text” name=“textbox”>
Attributes
• Attributes are instructions that clarify or modify an element.
• Attributes allow us to add extra information to an element.
• The img element for example requires the src (short for “source”) attribute to provide the
location of the image via its path or URL.
• The syntax for adding attributes is as follows:
<element name attribute-name=“value”>Content</element name>
<element name attribute-name=“value” />
<img src=“myphoto.jpg” alt=“This is my photo” />
<h2 style =“text-align: center; color:#FF0000”>
This is a heading content formatted according to the CSS rules specified using the style attribute.
</h2>
HTML Comments
• Just as comments are used in programming to document codes, HTML comments are not
displayed by the browser, but they can help document your HTML.
• With comments you can place notifications and reminders in your HTML document.
• The syntax for HTML comments is given below:
• <!-- Your comment goes here -->
e.g <!-- This is a comment in HTML -->
<!-- Do not display this at the moment
<img src="pic_mountain.jpg" alt="Mountain">
-->
HTML Document Structure
• The way a document is marked up with elements and their attributes is according to a
Document Type Definition(DTD).
• DTD are set of rules that govern the way in which a document can be marked up.
• The authoritative source for information about HTML and the HTML DTD is the World
Wide Web Consortium(W3C) at http://www.w3c.org.
Basic HTML5 Document Structure
<!DOCTYPE html>
<html lang=“en”>
<head>
<title> Title of web page goes here. </title>
<meta name= “viewport” content= “width=device-width, initial-
scale=1.0”>
</head>
<body>
Main content of the web page goes here.
This is what is displayed in the web browser window
</body>
</html>
Detailed HTML5 Document Structure
<!DOCTYPE html>
<html lang=“en”>
The <!DOCTYPE> Tag
• The Document Type , or doctype for short is indicated by the <!DOCTYPE> tag in
HTML documents.
• This specifies the rules for the document language so the browser knows how to
interpret the HTML code and display it properly.
The <html>…</html> Tag
• The <html> </html> tags surround the entire HTML document and its referred to as the
root element.
• The root element is the container element for all other elements in the document
• The opening tag ; <html> tells the browser that, whatever content that comes after it
should be treated as an HTML content until the browser meets the closing tag </html>.
The <head> </head> Tags
• The <head> </head> tags specify the header segment of any HTML document.
• The <title> </title> tags are used within the <head> </head> tags to specify the title of a
given web page.
• Other tags such as <meta>, <link>, <style> and <script> are also used within the
<head> tag of an HTML document.
White #FFFFFF
Black #000000
Red #FF0000
Green #00FF00
Blue #0000FF
Magenta #FF00FF
Cyan #00FFFF
Yellow #FFFF00
Aquamarine #70DB93
Violet #9F5F9F
Brass #B5A642
Copper #B87333
Pink #FF6EC7
Orange #FF7F00
<style>
div{
background-color: #9d00ff;
color: white;
}
span{
background-color: hsl(277, 100%, 50%);
color: rgb(255,255,255);
}
</style>
HTML Entities
• HTML entities define a way of representing reserved HTML characters and special
characters not present on your keyboard.
• For instance if you use the less than (<) or greater than (>) signs in your text, the browser
might mix them with tags.
• Entities in HTML documents are represented as: &entity_name; or &#entity_number ;
• E.g < or < for the less than(<) symbol.
4. Type a text content of your choice within the <body> </body> tags of the document
structure.
5. From the File menu of your chosen text editor, click on Save As and choose a suitable
location for saving your file.
6. In the File name: text box enter “filename.html” and in the Save as type: combo box,
choose All Files if you used Notepad or Hyper Text Markup Language
file(*.html;*.htm;*.shtml;*.shtm;*.xhtml;*.hta) if you used notepad++.
7. Click on the Save button to return to the window of your chosen text editor.
8. Navigate to the location where you saved your “filename.html” ; it should appear in the
icon of the default web browser on your PC with the name “filename” .
9. Double click on it to preview your page in the browser.
Practice Session
1. Launch a text editor of your choice.
2. Type the required HTML document structure.
3. Type the text below in the body segment of the document structure produced in step 2.
Hi Pals!. HTML is really easy to learn. All you need is a simple text editor and a web browser
and you are good to go. The most important thing here is to learn and understand the various
tags that are used within the body segment of the entire document structure. Any way, thanks to
my Web Technologies lecturer!
4. Save the file as firstpage.html a folder you created earlier.
5. Double click on the ‘firstpage.html’ to preview it in your default browser.
6. Go back to the file ‘firstpage.html’ and right-click on it and then select edit with…..and
choose the text editor you used.
7. Make changes to the file, save it and preview the edited version in your chosen browser.
Focus Questions
1. Differentiate between HTML tags and HTML elements with examples.
2. Produce a sample HTML page that shows your curriculum vitae using a text editor of
your choice and preview the file in a browser of your choice.
3. Find out and read on the evolution of HTML from HTML 1.1 to HTML5.
4. List and explain the new elements in HTML 5.
Formatting HTML Documents
• Formatting is about modifying the appearance of text and other contents on a web page.
• According to the current trend of web development, formatting web pages is better
handled using CSS.
• The commonly used tags for formatting within HTML documents are:
• <h1> Heading 1</h1>. The heading tags are from <h1> through to <h6>, with <h6>
being the smallest.
• <p>Paragraph</p><pre> Preformatted Text</pre>
HTML Text Formatting Tags
Tag Description
Tag Description
Unordered List
• Unordered list is used when the list of items does not have any necessary sequence of
appearance.
• It is also called a bulleted list.
• A bullet is a decorative label assigned to each item in a list.
• Unordered lists are enclosed in the <ul> </ul> tags.
• Each list item is placed within the <ul> </ul> tags using the <li> </li> tags
• The syntax for the unordered list is similar to that of ordered list with the type attribute
set to circle, disc or square.
• You may also use the style attribute to specify your type of bullet
• A style attribute can be added to an unordered list, to define the style of the marker:
Style Description
<html>
<head>
<title>Unordered List </title>
</head>
<body>
Definition Lists
• This is used to present a term and its definition formatted like a glossary or a dictionary.
• It is the ideal format to present lists of words or phrases with their meanings.
• The tags used are
<dl>
<dt> Definition Term </dt>
<dd> Definition Description </dd>
</dl>
Tag Description
Creating Links-
• A static web page contains no links within the document or to other documents.
• In order to give users some interactivity and control over our web pages, we need to
incorporate links to files or other pages of interest.
• Creating links in HTML documents is an important step in web site development because
it adds the “hyper” to the term hypertext.
• A hypertext document is one that contains elements called LINKS that allow users to
activate a particular part of the screen and perform some action.
• These actions include:
• Moving to another part of the same web page.
• Opening another web page on the same web site.
• Opening a web page on a web site somewhere else in the world.
Types of Links
• There are three main types of links namely:
1. Intra-page links
– These are links to items located within a single document or web page.
2. Intra-system links
– These are links to other pages of the same web site.
3. Inter-system links
– These are links to web pages or documents located on other web sites or web
servers.
Focus Questions?
1. Create three related web pages and link them together using the <a> </a> tag.
2. Using the <img /> tag, insert your own photograph in one of the pages created above.
3. Using the <audio> and <video> tags insert audio and video contents into the web pages
you created.
Element Description
Spanning Columns
• The colspan attribute lets you create cells that span multiple columns of a table.
• Column cells always span to the right.
• The syntax is given as:
<tr>
<td colspan=“number of columns”> Content goes here.</td>
</tr>
• Example:
<tr>
<td colspan=“3”>
This text spans across 3 columns.
</td>
</tr>
Spanning Rows
• The rowspan attribute lets you create cells that span multiple rows of a table.
• Rows always span down.
• The syntax is given as:
<tr>
<td rowspan=“number of rows”> Content goes here.</td>
</tr>
• Example:
<tr>
<td rowspan=“4”> This text spans across 4 rows down.</td>
<th>Name</th>
<th>Phone</th>
<th>Email</th>
</tr>
Organizing HTML Table Contents
• For code organization, rows can be grouped into head, body, and footer sections using the
<thead>, <tbody>, and <tfoot> elements respectively. E.g
• <table>
• <thead>
• <tr><th>Header Cell 1</th> <th>Header Cell 2</th> </tr>
• </thead>
• <tbody>
• <tr> <td>Body Cell 1</td> <td>Body Cell 2</td> </tr>
• <tr><td>Body Cell 3</td> <td>Body Cell 4</td> </tr>
• </tbody>
• <tfoot>
• <tr><td>Footer Cell 1</td> <td>Footer Cell 2</td> </tr>
• </tfoot>
• </table>
TAG DESCRIPTION
Introduction to Scripting
• Scripting is the act of writing little computer programs that can enhance the appearance
and functionality of web page.
• Scripts are executed either at the server-side or at the client-side.
• This leads to two categories of scripting:
– Server-side scripting and
– Client-side scripting.
Server-Side Scripting
• Server-side scripting is a web server technology in which a user's request is fulfilled by
running a script directly on the web server to generate dynamic web pages.
• This is different from client-side scripting where scripts are run by the viewing web
browser.
• It is usually used to provide interactive web sites that interface to databases or other data
stores.
• The primary advantage to server-side scripting is the ability to highly customize the
response based on the user's requirements, access rights, or queries into data stores.
• Some commonly used server-side scripting languages are:
• PHP (*.php)
• ASP/ASP.NET (*.asp/*.aspx)
• Perl (*.pl)
• ColdFusion Markup Language (*.cfm)
• Java via JSP(*.jsp)
• Python (*.py)
• Ruby (*.rb)
Client-Side Scripting
• Client-side scripting is a type of scripting that does all of its processing on the user's own
computer.
• It is commonly used to create pop-up windows, instant-redirect pulldown menus,
shopping-cart calculations, and mouseover effects (i.e., menus or images that change
when the user's mouse passes over them).
• Javascript is the most popular client-side scripting language
The <script> </script> Tag Pair
• The <script > </script> container is used to enclose the actual elements of the scripting
language.
• The common attributes of this tag are:
src, type and language
• The src attribute is used to specify the URL of an external script into the HTML
document.
• The external source file should contain no HTML codes and must use the appropriate file
extension.
• e.g: <script src=“coolscripts.js”></script>
• The type attribute should always be used with <script> container.
• It is used to specify the scripting language used for a particular script.
E.g
<script type=“text/javascript”>
alert( “Javascripts codes go here!”);
</script>
Focus Questions/Action
Visit https://www.w3schools.com and read on the following:
1. HTML Layout
2. HTML Responsive Web Design
3. HTML5 new Elements.
What is a CSS?
CSS is stands for Cascading Style Sheets.
CSS is a language that defines style constructs such as fonts, colors and positions which
are used to describe how information on a web page is formatted and displayed.
CSS is a style language that defines layout and appearance of HTML documents.
CSS, is the recommended way to control the presentation layer in web document projects
by creating robust style rules.
Overview of CSS
• A style sheet is a grouping of formatting instructions that can control the appearance of
many HTML pages at once.
• CSS enables you to set a great number of formatting characteristics that were never
possible before with any amount of effort.
Benefits of Using CSS
• By externalizing the presentation layer, CSS offers a number of significant benefits:
1. All styling is kept in a limited number of style sheets.
2. There is some saving on bandwidth.
3. The separation of content from presentation makes it easier for site owners to reuse the
content for other purposes.
4. Separate styling rules can be used for different output media.
CSS Selectors
Rules or Style Declarations begin with CSS Selectors.
The Selector is very important because it tells the web browser which HTML element to
style.
The following are the Core CSS Selectors:
Tag or Element
Descendant
Pseudo-Class
Universal
Id
Class
Descendant Selectors
A descendant selector matches any element that is a descendant of another—in other
words, an element that is nested at any level inside another.
To create a descendant selector, separate the two selectors by a space, and putting the
descendant (nested) element on the right.
For example, the following style rule changes the font size of paragraphs nested at any
level inside a <blockquote> tag:
blockquote p { font-size: 13px; }
Pseudo-class Selectors
Pseudo-classes and pseudo-elements are used to apply styles to elements based on their
state or position in the document.
Apply a pseudo-class or pseudo-element by appending it to a basic selector.
For example, a:link applies the :link pseudo-class to the <a> tags.
The p:first-letter applies the :first-letter pseudo-element to the <p> tags.
Universal Selectors
Universal Selector is indicated with an asterisk *.
The purpose of this selector is to make style one time and it will be applied to every
single elements on the web page
The most common use of the universal selector is to remove, or zero out, all margins and
padding. For example,
* {margin: 0px; padding: 0px;}
Id Selector
An Id Selector is indicated by preceding its name by the pound # sign.
Id selectors are used for page elements that appear one time on a web page and require
unique formatting instructions.
For example, an Id selector could be :
#dare { text-indent: 3em }
This would be referenced in HTML by the id attribute as shown here:
<p id= “dare” >Text indented 3em</p>
Class Selector
A class selector’s name is preceded by a full stop (.).
Unlike Id selectors, a class selector can be applied to several elements on a web page.
An example would be if you want to give all the paragraphs on your web page the same
styling.
.note {background-color: #013370;
color: white;
font-size: small;
}
This would be referenced in HTML by the class attribute of the element:
<p class= “note” >This my paragraph</p>
Styling Background
• CSS background properties are used to define the background effects of an element.
• CSS properties used for background effects:
– background-color
– background-image
– background-repeat
– background-attachment
– background-position
Background Color
• The background-color property specifies the background color of an element.
• The background color of a page is defined in the body selector:
body {background-color:#b0c4de;}
• The background color can be specified by:
– Name - a color name, like "red"
– RGB - an RGB value, like "rgb(255,0,0)"
– Hex - a hex value, like "#ff0000“
Background Image
• The background-image property specifies an image to use as the background of an
element.
• By default, the image is repeated so it covers the entire element.
• The background image for a page can be set like this:
• Example
body {background-image: url(‘path to the image file’);}
Styling Links
Links can be style with any CSS property such as color, font-family, and background-
color.
Links can be styled differently depending on what state they are in.
The four link states and the order of styling them are:
a:link - normal, unvisited link
a:visited – link’s state when the user has visited it
a:hover – link’s state when the user mouses over it
a:active – link’s state the moment it is clicked
a:link {color:#FF0000;} /* unvisited link */
a:visited {color:#00FF00;} /* visited link */
a:hover {color:#FF00FF;} /* mouse over link */
a:active {color:#0000FF;} /* selected link */
When setting the style for several link states, these order rules must be applied:
a:hover MUST come after a:link and a:visited
a:active MUST come after a:hover
Focus Questions
Visit https://www.w3schools.com and read on the following:
1. Attribute selectors
2. Combinator selectors,
3. Pseudo-elements selector,
4. The CSS Box Model.