HTML and Css For Newbies STANDARD
HTML and Css For Newbies STANDARD
First edition
Acknowledgments iv
Foreword v
Introduction vii
1 Chapter 1 1
Getting Started 1
Text editor 1
Steps on how to create a new html page file 2
2 Chapter 2 8
Introduction 8
What is HTML and CSS ? 8
HTML 9
CSS 9
Differences between HTML and CSS 11
3 Chapter 3 13
There many HTML tags but we going to
show you the basic and most important
ones so that you might be able to make
your own basic web page after reading this book. 17
4 Chapter 4 20
<meta> 20
5 Chapter 5 22
<head> </head> 22
6 Chapter 6 23
<body> </body> 23
7 Chapter 7 25
<h1></1> to <h6></h6> 25
8 Chapter 8 27
<p></p> 27
9 Chapter 9 29
<img> 29
10 Chapter 10 32
<li> </li> 32
Unordered List <ul></ul> 33
Ordered List <ol></ol> 33
11 Chapter 11 35
<table></table> 35
12 Chapter 12 37
<input> 37
13 Chapter 13 43
<form> </form> 43
14 Chapter 14 46
<a href = “” ></a> 46
15 Chapter 15 51
<style></style> 51
16 Chapter 16 53
Id and class 53
17 Chapter 17 55
18 Chapter 18 61
19 Chapter 19 63
Color 63
20 Chapter 20 65
Font Size 65
21 Chapter 21 67
Background Color 67
22 Chapter 22 69
Height/Width 69
23 Chapter 23 71
Border 71
24 Chapter 24 74
Background Image 74
25 Chapter 25 76
Border-Radius 76
About the Author 81
Also by Tatenda J Majira 83
Acknowledgments
iv
Foreword
Happy coding!
vi
Introduction
On the other hand, CSS is the stylistic layer that breathes life
into HTML elements. With CSS, developers can control the
layout, typography, colors, and overall appearance of a web
page. By separating the content from its presentation, CSS
enables flexibility and consistency across a website, making it
easier to maintain and update.
viii
1
Chapter 1
Getting Started
Text editor
First of all for you to start writing html or css you need to
have a text-editor in your laptop or phone .A text editor is an
application for writing text and saving them as a file eg Notepad
.
1
HTML AND CSS FOR NEWBIES
2
CHAPTER 1
3
HTML AND CSS FOR NEWBIES
4
CHAPTER 1
Note that after typing the name of page put .html so that it will
be saved as a webpage for it to open on a browser .The name of
my page is newbies.html.
If you don’t add .html on the file name of your page it won’t
open on browsers.
The same steps are done when you want to create a css file
.The difference is that when it is css you save your file as name
of file .css .
5
HTML AND CSS FOR NEWBIES
Your html file should have an icon of a web browser you use
.Mine has a google chrome icon because my default browser is
google.
6
CHAPTER 1
7
2
Chapter 2
Introduction
8
CHAPTER 2
HTML
CSS
HTML stands for Cascading Style Sheets.CSS defines the style
( visual ) of web page.
Don’t forget HTML defines the skin of a web page eg color
,background ,font ,border etc
9
HTML AND CSS FOR NEWBIES
10
CHAPTER 2
2. HTML is easy to learn and has clear syntax, whereas CSS can
sometimes get messy and can create complications in codes.
11
HTML AND CSS FOR NEWBIES
with HTML.
4. The HTML file can contain CSS codes, but on the other
hand, CSS can never contain HTML codes in it.
12
3
Chapter 3
13
HTML AND CSS FOR NEWBIES
<HTML TAGS>
14
CHAPTER 3
15
HTML AND CSS FOR NEWBIES
16
CHAPTER 3
17
HTML AND CSS FOR NEWBIES
18
CHAPTER 3
Note the highlighted text are the tags that are inside the body
tag <p></p> and <h1></h1>
19
4
Chapter 4
<meta>
<meta name=“description” content=”Teaching newbies how to
code using HTML and CSS”>
20
CHAPTER 4
Information or values that are put inside the meta tag are the
one that we see when we search for something as on the picture
below
21
5
Chapter 5
<head> </head>
Inside the head tag is where we find meta tag , style tag (where
we put our CSS ) and links.
22
6
Chapter 6
<body> </body>
The <body> tag defines the document’s body. The <body>
element contains all the contents of an HTML document, such
as headings, paragraphs, images, hyperlinks, tables, lists, etc.
Note: There can only be one <body> element in an HTML
document.
23
HTML AND CSS FOR NEWBIES
24
7
Chapter 7
<h1></1> to <h6></h6>
These tags are used to define HTML headings.
25
HTML AND CSS FOR NEWBIES
If you notice each and every H tag represents a certain size for
a text.
26
8
Chapter 8
<p></p>
This tag defines a paragraph.
27
HTML AND CSS FOR NEWBIES
28
9
Chapter 9
<img>
The <img> tag is used to embed an image in an HTML page.
Images are not technically inserted into a web page; images
are linked to web pages. The <img> tag creates a holding space
for the referenced image.
The <img> tag has two required attributes:
29
HTML AND CSS FOR NEWBIES
30
CHAPTER 9
Note that inside the source (src) is where u put the path where
the image is located on and then the image name .In the above
example the name of my image is newbies.jpg. Make sure the
html file is in the same folder with image and CSS files.
31
10
Chapter 10
<li> </li>
These tags are used to group a set of related items in lists
32
CHAPTER 10
The HTML <ol> tag defines an ordered list. An ordered list can
be numerical or alphabetical.
33
HTML AND CSS FOR NEWBIES
34
11
Chapter 11
<table></table>
Theses tags are used to arrange data into rows and columns.
35
HTML AND CSS FOR NEWBIES
36
12
Chapter 12
<input>
These tags are used when we want to get user input from eg
register form , login form .
• <input type=“button”>
• <input type=“checkbox”>
• <input type=“color”>
• <input type=“date”>
• <input type=“datetime-local”>
• <input type=“email”>
• <input type=“file”>
• <input type=“hidden”>
• <input type=“image”>
• <input type=“month”>
• <input type=“number”>
37
HTML AND CSS FOR NEWBIES
• <input type=“password”>
• <input type=“radio”>
• <input type=“range”>
• <input type=“reset”>
• <input type=“search”>
• <input type=“submit”>
• <input type=“tel”>
• <input type=“text”>
• <input type=“time”>
• <input type=“url”>
• <input type=“week”>
38
CHAPTER 12
As you can see the output of the inputs tags on the webpage
presented well .To put them in order we use the <br> it breaks
or creates a new empty line
39
HTML AND CSS FOR NEWBIES
40
CHAPTER 12
41
HTML AND CSS FOR NEWBIES
42
13
Chapter 13
<form> </form>
This <form> element is used to create an HTML form for user
input:
43
HTML AND CSS FOR NEWBIES
<label> </label>
44
CHAPTER 13
45
14
Chapter 14
<a href=“https://www.google.com/”>Google</a>
46
CHAPTER 14
If you click on the text Google it will direct you to Google page
47
HTML AND CSS FOR NEWBIES
48
CHAPTER 14
Now click on the link below and it will direct you to newbies2
page.
49
HTML AND CSS FOR NEWBIES
Newbies2 page
50
15
Chapter 15
<style></style>
The HTML style attribute is used to add styles to an element,
such as color, font, size, and more.
<tagname style=“property:value;”>
This tag can be used inside the head tag to style elements inside
the body but for the mean time will focus on styling inside the
tag.
51
HTML AND CSS FOR NEWBIES
52
16
Chapter 16
Id and class
53
HTML AND CSS FOR NEWBIES
Below is how you use the IDs and Classes inside the <style>
using css .
54
17
Chapter 17
Like discussed in the the first chapter css is used for styling the
html page or elements .
55
HTML AND CSS FOR NEWBIES
Example:
56
CHAPTER 17
57
HTML AND CSS FOR NEWBIES
text.
58
CHAPTER 17
59
HTML AND CSS FOR NEWBIES
60
18
Chapter 18
Color
Font Size
Background Color
Background
61
HTML AND CSS FOR NEWBIES
Height/Width
Box Model (Margin/Padding)
Border
Border Radius
62
19
Chapter 19
Color
This is most used property in css .It is used for changing the
text color .
There are multiple valid formats for color values, however
the most common are hex values, rgba and named colors
/* Hex Value */
color: #000000;
/* RGBA */
color: rgba(0, 0, 0, 0.3);
/* Named Colors */
color: black;
As newbies using named colors is much easier and simple
63
HTML AND CSS FOR NEWBIES
64
20
Chapter 20
Font Size
This property is used to specify the size of text .
The font-size property allows us to change the size of the font
for any text based content. This includes <h1> to <h6> tags ,
<a> tag,<p> tags etc
65
HTML AND CSS FOR NEWBIES
66
21
Chapter 21
Background Color
The background-color property allows you to set the
background-color of an HTML element. Just like text color,
the value of this property can be a hex value, rgba or named
color.
The background color can be set like so:
67
HTML AND CSS FOR NEWBIES
68
22
Chapter 22
Height/Width
The height and width properties specify the height and width of
a HTML element respectively. There are many different values
you can apply to both of these properties, but for this tutorial
we’ll focus on pixels (px) and percentages (%)
69
HTML AND CSS FOR NEWBIES
Note that the width and height of the <p> text has changed
70
23
Chapter 23
Border
The border property allows you set a border for your HTML
element. We can create a border around our <img> element
with the following syntax:
71
HTML AND CSS FOR NEWBIES
72
CHAPTER 23
73
24
Chapter 24
Background Image
The background-image property allows us to add a background
image to an HTML element. This is similar to the background
color, however an image is shown instead of a color.
We are going to put a background image on the h1 tag
74
CHAPTER 24
75
25
Chapter 25
Border-Radius
The border-radius property allows you to add rounded corners
of a HTML elements. This can be especially useful for adding
rounded corners to buttons and images.
In action, if we wanted to round the corners of an <img>
element, we could add the following in our stylesheet:
76
CHAPTER 25
Note that the image will change on its corners after styling with
border-radius property
77
HTML AND CSS FOR NEWBIES
78
CHAPTER 25
79
HTML AND CSS FOR NEWBIES
80
About the Author
82
Also by Tatenda J Majira
Summoning a demon AI
Exploring the Dark Side of Artificial
Intelligence” delves into the shadows of
technology to uncover the darker implica-
tions of artificial intelligence. Written by
computer systems engineer Tatenda Majira,
this thought-provoking book examines the
ethical dilemmas, societal impacts, and
potential risks associated with AI, from privacy violations
and algorithmic biases to job displacement and the erosion
of human autonomy. Through insightful analysis and real-
world examples, Tatenda Majira navigates the complexities of
AI’s dark side, challenging readers to confront the ethical and
social implications of unleashing advanced AI technologies. A
must-read for anyone interested in understanding the darker
dimensions of AI and its impact on society.
83