Introduction To HTML
Introduction To HTML
1. Basic Structure
The basic structure of any HTML document is as follows:
<!DOCTYPE html>
<html>
<head></head>
<body>
Your code goes here
</body>
</html>
2. Heading Element
The HTML h1 element defines a main heading.
<h1>Tourism</h1>
3. Paragraph Element
The HTML p element defines a paragraph.
<p>Plan your trip wherever you want to go</p>
4. Button Element
The HTML button element defines a button.
<button>Get Started</button>
Introduction to CSS | Part 1
HTML Elements
1. Container Element
The HTML div element defines a container.
<div>
<h1>Tourism</h1>
<p>Plan your trip wherever you want to go</p>
<button>Get Started</button>
</div>
CSS Properties
2. Syntax
selector {
property1: value1;
property2: value2;
}
3. Text Align
The CSS text-align property specifies the horizontal alignment of the text in an
HTML element.
.h-center {
text-align: center;
}
Value Description
Sample Colors
Value
blue
orange
red
green
CSS Background Properties
2. Background Color
The CSS background-color property specifies the background color of an HTML
element.
.card {
background-color: lightblue;
}
1. Font Family
The CSS font-family property specifies the font for an element.
.main-heading {
font-family: "Roboto";
}
.paragraph {
font-family: "Roboto";
}
You can use one of the below values of the font-family property,
Value
Note
To use font families, you need to import their style sheets into your CSS
file.
There shouldn't be any spelling mistakes in the values of the font-family
property.
There must be quotations around the value of the font-family property.
2. Font Size
The CSS font-size property specifies the size of the font.
.main-heading {
font-size: 36px;
}
.paragraph {
font-size: 28px;
}
Note
You must add px after the number in the value of the font-size property.
There shouldn't be any space between the number and px.
There shouldn't be any quotations around the value of the font-size
property.
3. Font Style
The CSS font-style property specifies the font style for a text.
You can use one of the below values of the font-style property,
Value
Normal
Italic
oblique
.main-heading {
font-style: italic;
}
.paragraph {
font-style: normal;
}
Note
There shouldn't be any spelling mistakes in the values of the font-style
property.
There shouldn't be any quotations around the value of the font-style
property.
4. Font Weight
The CSS font-weight property specifies how thick or thin characters in text
should be displayed.
.main-heading {
font-weight: bold;
}
.paragraph {
font-weight: 200;
}
You can use one of the below values of the font-weight property,
Value
normal
bold
bolder
lighter
100
200
300
400
500
600
700
800
900
Note
There shouldn't be any spelling mistakes in the values of the font-weight
property.
There shouldn't be any quotations around the value of the font-weight
property.
The numerical values given to the font-weight property must be in the
range from 100 to 900 and should be the multiples of 100.
5. Text Decoration
The CSS text-decoration property specifies the decoration added to the text.
.main-heading {
text-decoration: underline;
}
.paragraph {
text-decoration: overline;
}
You can use one of the below values of the text-decoration property,
Value Description
Note
There shouldn't be any spelling mistakes in the values of the text-
decoration property.
There shouldn't be any quotations around the value of the text-
decoration property.
Ensure that text-decoration and line-through are hyphenated.
2. Width
The CSS width property specifies the width of an HTML element.
.card {
width: 250px;
}
Value Description
Warning
The background image takes the height of the content of an HTML
element if you don't specify the height to it.
The URL given to the background-image must be a valid URL to display
the image.
2. Background Size
The CSS background-size property specifies the size of the background image
of an HTML element.
.card {
background-size: cover;
}
Value Description
Note
Aspect Ratio is the ratio of the width and height (width/height) of an
image.
Viewport
The browser's viewport is the area of the window in which web content can be
seen.
1. Viewport Height
The CSS Viewport Height vh Unit equals to 1% of the height of the Viewport
(browser window size).
.card {
height: 50vh;
}
Note
The height 100vh sets an HTML element to the entire height of the
Viewport (browser window size).
2. Viewport Width
The CSS Viewport Width vw Unit equals to 1% of the width of the Viewport
(browser window size).
.card {
width: 100vw;
}
Note
The width 100vw sets an HTML element to the entire width of the
Viewport (browser window size).
2. Border Radius
The CSS border-radius property specifies the roundness of the corners of an
HTML element.
.button {
border-radius: 20px;
}
You can use the below CSS properties to round a specific corner of an HTML
element.
Property
border-top-left-radius
border-top-right-radius
border-bottom-left-radius
border-bottom-right-radius
Quick Tip
Specifying the background color for an HTML element makes the border
radius more visible.
3. Border Color
The CSS border-color property specifies the color of the border for all four
sides of an HTML element.
.button {
border-color: orange;
}
Warning
Specifying the CSS border-style property for an HTML element is
mandatory. Otherwise, the CSS properties like border-color, border-
width will not appear in the browser. The HTML button element is an
exception as it appears with a border in the browser by default.
4. Border Style
The CSS border-style property specifies the style of the border for all four sides
of an HTML element.
.button {
border-style: dashed;
}
You can use one of the below values of the CSS border-style property.
Value
dotted
dashed
solid
none (default)
5. Padding
The CSS padding property specifies the space around the content of an HTML
element.
.card {
padding: 10px;
}
CSS Colors
1. Hex Code
CSS Colors can be represented in multiple ways:
Color names
Hex Code
HSL
RGB and many more...
Since few colors have the Color names, Hex Codes make a good alternative to
pick a wide variety of colors.
Some of the Color names and their Hex Codes are:
orange #ffa500
red #ff0000
blue #0000ff
green #008000
- #012d36
- #432711
.button {
background-color: #25b1cc;
}
3. Bootstrap
Bootstrap is a large collection of predefined reusable Code Snippets written in
HTML, CSS, and Javascript. The Code Snippets include Buttons, Cards,
Carousels, etc.
Note
By default, Bootstrap class name btn has no background color.
Warning
Using predefined bootstrap class names as a selector in our CSS Ruleset
may give unexpected results.
Do's
.button {
border-radius: 5px;
height: 50px;
width: 138px;
background-color: blue;
color:white;
}
<button class="button">Get Started</button>
Dont's
.btn {
border-radius: 5px;
height: 50px;
width: 138px;
background-color: blue;
color:white;
}
<button class="btn">Get Started</button>
Flexbox Properties
1. Flexbox Container
The Bootstrap class name d-flex defines a Flexbox Container. The direct HTML
elements in the Flexbox Container are called flex items.
<div class="d-flex">
<div>
<h1>Tourism</h1>
<p>Plan your trip.</p>
<button>Get Started</button>
</div>
</div>
The HTML container element with the class="d-flex" is a Flexbox Container.
The HTML container element div in Flexbox Container is a flex item. Because it
is directly inside the Flexbox Container.
The HTML main heading, paragraph, and button elements are not flex items.
Because these elements are not directly inside the Flexbox Container.
Note
Wrapping HTML elements in the Flexbox Container is mandatory to
apply other flex properties.
2. Flex Direction
The Flex Direction specifies the direction of the flex items in the Flexbox
Container.
flex-row Horizontal
flex-column Vertical
2.1 flex-row
The Bootstrap class name flex-row is used to move the flex items horizontally
in the Flexbox Container.
<div class="d-flex flex-row">
<div>
<h1>Tourism</h1>
<p>Plan your trip.</p>
<button>Get Started</button>
</div>
</div>
2.2 flex-column
The Bootstrap class name flex-column is used to move the flex items vertically
in the Flexbox Container.
<div class="d-flex flex-column">
<div>
<h1>Tourism</h1>
<p>Plan your trip.</p>
<button>Get Started</button>
</div>
</div>
Note
The Bootstrap class name flex-row is the default Flex Direction for the Flexbox
Container. So, once d-flex is specified, all the flex items in the Flexbox
Container display horizontally.
3. Justify Content
The Justify Content specifies the alignment of flex items along the Flex
Direction in a Flexbox Container.
3.1 justify-content-start
The Bootstrap class name justify-content-start is used to align the flex items at
the start of the Flexbox Container either horizontally or vertically based on the
Flex Direction.
3.3 justify-content-end
The Bootstrap class name justify-content-end is used to align the flex items at
the end of the Flexbox Container either horizontally or vertically based on the
Flex Direction.
1. HTML Elements
1.1 Image Element
The HTML img element defines an Image.
Syntax: <img src="IMAGE_URL"/>
2. Void Elements
The HTML elements that only have a start tag and do not contain content or
end tag are called as Void Elements.
Syntax: <tag />
For example, the HTML img element.
<img src="https://d1tgh8fmlzexmh.cloudfront.net /tajmahal-img.png"/>
Property
margin-top
margin-right
margin-bottom
margin-left
Approach to Develop a Layout
1. Bootstrap Components
1.1 Carousel
The Carousel is a slideshow for cycling through images, text, etc. Slides will
change every few seconds.
To add the Carousel to our Favourite Place Detailed View Section Page, we
used Bootstrap Carousel Component with the Indicators.
You can add the different images in the Carousel by changing the image URL in
the value of the HTML src attribute.
<img
class="d-block w-100"
src="https://d1tgh8fmlzexmh.cloudfront.net/ccbp-static-website/tajmahal-
c1-img.png"
alt="...">
/>
Bootstrap Carousel Code is in the Bootstrap official website.
2. Bootstrap Utilities
2.1 Embed
The given code snippet is the Youtube embed code provided by Bootstrap. You
can add the different Youtube Videos by changing the Video ID in the value of
the HTML src attribute.
The Video ID is in between the https://www.youtube.com/embed/ and ?rel=0.
<div class="embed-responsive embed-responsive-16by9">
<iframe
class="embed-responsive-item"
src="https://www.youtube.com/embed/49HTIoCccDY?rel=0"
allowfullscreen
></iframe>
</div>
Note
Be careful while pasting the video ID. The video ID must be in between
the https://www.youtube.com/embed/ and ?rel=0. You won't get the
video if any character is missed in the value of the HTML src attribute.
Website Integration
1. CCBP UI Kit
It is a collection of reusable code snippets similar to Bootstrap. It is specially
designed for CCBP training.
3. HTML Attributes
3.1 The HTML id Attribute
The HTML id attribute specifies a unique id for an HTML element. The value of
the id attribute must be unique within the HTML document.
<div id="section1">Section 1</div>
Warning
The CCBP UI kit works only if the value of the HTML id attribute of the
container section has the prefix as section.
So, the id which we specify for any section should always contain its
prefix as section if you are using CCBP UI Kit.
Note
While Integrating the sections with CCBP UI Kit, the ids of the section
container must have a prefix section. Otherwise it doesn't work.
Note
To use multiple Carousels in the same HTML document, we have to
provide a unique id to each Carousel.
So while adding a new Carousel, you need to change the id of the
Carousel. Else, the Carousel controls don’t work.
3. HTML Lists
The List is a way to group related pieces of information so that they are easy to
read and understand.
For example, Shopping list, Todo list, etc.
There are mainly two types of Lists available in HTML.
Unordered List
Ordered List
square
Circle
Disc
none
Value
upper-alpha
lower-alpha
upper-roman
lower-roman
decimal
none
HTML Hyperlinks
Note
While navigating to a particular section within the same HTML document, the
content of that section doesn't start from the starting of a page when
It has less content to fill the Viewport height and there are no sections
after it.
The content of that section and the content of the sections after it has
less content to fill the Viewport height.
Note
To Sign up, copy the Cloudinary Website URL and open in new tab.
Note
You need to add the HTML link element in the HTML head element.
THE END