HTML & CSS - But First My Take On Web Development
HTML & CSS - But First My Take On Web Development
Rupayan Neogy
But first…
My Take on
Web Development
There is always some
tool that makes your life
easier.
Hypertext Markup Language
The language your web browser uses to describe the
content and structure on web pages
But first…
My Take on
HTML
HTML = Nested Boxes
HTML = Nested Boxes™
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
HTML Tags
Opening tag
<html>
</html>
Closing tag
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
HTML Tags
<a>
<b>
</a>
</b>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
Basic HTML Elements
<html> Root of HTML Document
<head> Info about Document
<body> Document Body
<h1>, <h2>, <h3>, … Header tags
<p> Paragraph tags
Basic HTML Elements
<html> Root of HTML Document
<head> Info about Document
<body> Document Body
<h1>, <h2>, <h3>, … Header tags
<p> Paragraph tags
Inserting Links
<a> Link
Link to 6.148!
HTML Attributes
attribute value
Opening tag
</a>
Closing tag
Inserting Links
<a href="http://6148.io">Link to 6.148!</a>
Link to 6.148!
Inserting Links
<a href="home.html">Link to home!</a>
Link to home!
Inserting Images
<img> Image
Inserting Images
<img src="pusheen.gif"></img>
Inserting Images
<img src="pusheen.gif">
Inserting Images
<img src="pusheen.gif">
app/
hello.html
pusheen.gif
Inserting Images
<img src="pusheen.gif">
<img src="images/pusheen.gif">
app/
hello.html
images/
pusheen.gif
Lists
<ol> Ordered List (1, 2, 3…)
<ul> Unordered List (bullets)
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<ul>
</ul>
</body>
</html>
hello.html
<!DOCTYPE html>
<html> • Item 1
<head>
<title>Title!</title>
</head>
<body>
<ul>
<li>Item 1</li>
</ul>
</body>
</html>
hello.html
<!DOCTYPE html>
<html> • Item 1
<head> • Item 2
<title>Title!</title>
</head>
<body>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</body>
</html>
div & span
<div> Block Section in Document
<span> Inline Section in Document
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<div>
<h1>Heading!</h1>
<p>Paragraph!</p>
</div>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<div>
<h1>Heading!</h1>
<p>Paragraph!</p>
</div>
</body>
</html>
<span>?</span>
the real way to learn
Web Dev
Step 1: Google!
the real way to learn
Web Dev
Step 2:
Learn.
the real way to learn
Web Dev
Hypertext Markup Language
The language your web browser uses to describe the
content and structure on web pages
Cascading Style Sheets
The rules that tell your web browser how stuff looks
But first…
My Take on
CSS
CSS = A list of
descriptions
p{
color: red;
font-family: Arial;
font-size: 24pt;
}
selector
p{
color: red;
font-family: Arial;
font-size: 24pt;
}
selector
property
p{
color: red;
font-family: Arial;
font-size: 24pt;
}
selector
property
p{ value
color: red;
font-family: Arial;
font-size: 24pt;
}
hello.html
<!DOCTYPE html>
<html> Heading
<head>
<title>Title!</title> Paragraph!
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html Heading
<h1>Heading!</h1> Paragraph!
<p>Paragraph!</p>
hello.html Heading
<h1>Heading!</h1> Paragraph!
<p>Paragraph!</p> Info
<p>Info</p>
hello.html
<h1>Heading!</h1>
<p>Paragraph!</p>
<p>Info</p>
Heading
Paragraph!
style.css Info
p{
color: red;
font-family: Arial;
font-size: 24pt;
}
hello.html
<h1>Heading!</h1>
<p>Paragraph!</p>
<p class="info">Info</p>
Heading
Paragraph!
style.css Info
p{
color: red;
font-family: Arial;
font-size: 24pt;
}
hello.html
<h1>Heading!</h1>
<p>Paragraph!</p>
<p class="info">Info</p>
Heading
Paragraph!
style.css Info
.info {
color: red;
font-family: Arial;
font-size: 24pt;
}
hello.html
<h1>Heading!</h1>
<p>Paragraph!</p>
<p id="unique">Info</p>
Heading
Paragraph!
style.css Info
#unique {
color: red;
font-family: Arial;
font-size: 24pt;
}
Class vs ID
Class ID
Can use the same class on Each element can have
multiple elements only one ID
Can use multiple classes Each page can have only
on the same element one element with that ID
Class vs ID
Class ID
Can use the same class on Each element can have
multiple elements only one ID
Can use multiple classes Each page can have only
on the same element one element with that ID
.classname { #id {
… …
} }
Combining
HTML & CSS
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
hello.html
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
<link rel="stylesheet"
type="text/css"
href="style.css">
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
In Conclusion:
HTML = nested boxes!
CSS = a list of descriptions
2
Exercise 1: Kitten Started
Open profile1.html in
chrome to see what it
looks like.
Change the name,
description, and status to
your choice.
BORDER
PADDING
CONTENT
Exercise 2: Feline Good
Make a class called “text-center” in style2.css
The class should make any element that has the class
have centered text.
Remember “.text-center”?
.text-center {
text-align: center;
}
What is Bootstrap?
• A collection of CSS Classes that add prebuilt
styles to your webpage.
Open BS/styleBS.css
Be amazed by how little CSS there is
Bootstrap Time!!
The most important line:
How to use Bootstrap
1. Open Documentation
2. Look for something that you like
3. Copy the code tutorial, modify
for your own purposes
4. Smile at how easy that was
How to use Bootstrap