























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This book is a concise and easy-to-understand guide to building responsive web pages using HTML and CSS. It is perfect for beginners who want to learn the basics of web development without getting bogged down in the technical details. The book covers all the essential topics, including: The basics of HTML and CSS, How to create a responsive web page, How to use Bootstrap, and more. Whether you are a complete beginner or you are looking to brush up on your skills, this book is a great resource for learning how to build responsive web pages.
Typology: Study notes
1 / 31
This page cannot be seen from the preview
Don't miss anything!
























HTML is the Hypertext Markup Language, the foundation of all web pages. It is a markup language, which means that it uses tags to define the structure and content of a web page.
The basic structure of any HTML document is as follows: HTML
My First HTML Page
This is my first HTML page!
This is a paragraph.
Click me!● The declaration tells the browser that this is an HTML document. ● The element is the root element of an HTML document. It contains the and elements. ● The element contains metadata about the document, such as the title and the character encoding. ● The element contains the content of the document, such as text, images, and other elements. Heading Element: The element defines a main heading. It can be used to create a hierarchy of headings, with being the largest and being the smallest. HTML This is a main heading This is a subheading This is a third-level heading Paragraph Element: The
element defines a paragraph. It is used to group together a block of text. HTML
This is a paragraph.
This is another paragraph.
Button Element: The element defines a button. It can be used to create interactive elements on a web page. HTML Click me!div { font-family: Helvetica, sans-serif; } Font Size: The font-size property specifies the size of the font. The value of the font-size property is a number followed by the unit of measurement, which can be px, em, or rem. For example, the following CSS code would set the font size of the div element to 16 pixels: CSS div { font-size: 16px; } Font Style: The font-style property specifies the font style for a text. The possible values for the font-style property are normal, italic, and oblique. For example, the following CSS code would set the font style of the div element to italic: CSS div { font-style: italic; } Font Weight: The font-weight property specifies how thick or thin characters in text should be displayed. The possible values for the font-weight property are normal, bold, bolder, lighter, and a number followed by the unit of measurement, which can be 100, 200, 300, 400, 500, 600, 700, 800, or 900. For example, the following CSS code would set the font weight of the div element to bold: CSS div { font-weight: bold; } Text Decoration: The text-decoration property specifies the decoration added to the text. The possible values for the text-decoration property are underline, line-through, and overline. For example, the following CSS code would underline the text in the div element: CSS
Viewport: The viewport is the area of the window in which web content can be seen. The CSS viewport height (vh) unit equals to 1% of the height of the viewport, and the CSS viewport width (vw) unit equals to 1% of the width of the viewport. For example, the following CSS code would set the height of the div element to 100% of the viewport height: CSS div { height: 100vh; } CSS Box Properties: The following are some common CSS box properties:
Bootstrap is a free and open-source CSS framework that helps you create responsive, mobile-first web pages. It provides a number of predefined CSS classes that you can use to style your HTML elements. Reusability of CSS Rulesets: If you want the same style for multiple HTML elements, you can write the CSS ruleset once and use it for different HTML elements. This is called the reusability of CSS rulesets. For example, the following CSS ruleset would set the font family, font size, and color of all h1 elements to Verdana, 16px, and black, respectively: CSS h1 { font-family: Verdana; font-size: 16px; color: black; } You can then use this ruleset for any h1 element in your HTML document. Multiple Class Names as an HTML Attribute Value You can provide multiple class names separated by space as a value to the HTML class attribute. For example, the following HTML code would add the btn and btn-primary class names to the button element: HTML Click me! The btn class name will apply the default button style, and the btn-primary class name will apply the primary button style. Bootstrap: Bootstrap is a large collection of predefined reusable code snippets written in HTML, CSS, and JavaScript. The code snippets include buttons, cards, carousels, and many more. How to Use Bootstrap? To use the code snippets provided by Bootstrap, you need to add the following code within the HTML head element: HTML
This will load the Bootstrap CSS file from a CDN (content delivery network).
.d-flex { flex-direction: column; } Justify Content: The justify-content property specifies the alignment of flex items along the Flex Direction in a Flexbox Container. The possible values for the justify-content property are:
start: The flex items are aligned at the start of the Flexbox Container.
center: The flex items are aligned in the center of the Flexbox Container.
end: The flex items are aligned at the end of the Flexbox Container.
space-between: The flex items are evenly spaced between the start and end of the Flexbox Container.
space-around: The flex items are evenly spaced around the Flexbox Container. For example, the following CSS code would change the justify-content of the Flexbox Container in the previous example to space-around: CSS .d-flex { justify-content: space-around; } HTML Elements:
Image Element The img element defines an image. It has a single required attribute, src, which specifies the path (URL) of the image. For example, the following HTML code defines an image with the source URL https://d1tgh8fmlzexmh.cloudfront.net/ccbp-static-website/tajmahal-img.png: HTML
Void Elements The HTML elements that only have a start tag and do not contain content or end tag are called as void elements. For example, the img element is a void element.
CSS Box Model Properties The CSS box model is a way of representing the layout of an HTML element. It consists of four parts:
The content: This is the actual text or image that is displayed in the element.
The padding: This is the space around the content.
The border: This is the line that surrounds the content and padding.
The margin: This is the space around the border.
The margin property specifies the space around the four sides of an HTML element. You can use the following CSS properties to apply a margin on the specific side of an HTML element:
My Website
Bootstrap Utilities: Bootstrap Utilities are a collection of helper classes that can be used to style your web pages. They are a great way to quickly and easily add common styles to your elements. One of the Bootstrap Utilities is the embed class. This class can be used to embed videos from YouTube, Vimeo, and other video platforms. To embed a video from YouTube, you can use the following code: HTML
This code will embed the YouTube video with the ID video_id in your web page. You can customize the appearance of the embedded video by using the embed-responsive-item class. For example, you can change the width and height of the video, or you can add a border around the video. HTML Lists: Lists are a way to group related pieces of information so that they are easy to read and understand. There are two main types of lists in HTML:
Painting Reading books Playing the guitar
Ordered Lists: Ordered lists are a collection of related items that follow some order or have a sequence. They are typically marked with numbers. To create an ordered list, you use the ol tag. Each list item starts with the li tag. For example, the following code creates an ordered list of web technologies: HTML
HTML
CSS JavaScript
Styling Lists: You can style the lists using CSS. The list-style-type property is used to change the bullets or numbers used in the list. For example, the following code changes the bullets in the unordered list to squares: CSS ul { list-style-type: square; } The following code changes the numbers in the ordered list to Roman numerals: CSS ol { list-style-type: lower-roman; } HTML Hyperlinks: Hyperlinks are text or images that allow users to navigate to other web resources or a specific element within the HTML document. They are also called links. The a element is used to create hyperlinks. The href attribute specifies the URL or path of the web resource that the link points to. The target attribute specifies where to open the linked web resource. For example, the following code creates a hyperlink that points to the Google homepage: HTML Google The target attribute can be used to open the linked web resource in a new tab or window. For example, the following code opens the linked web resource in a new tab: HTML Google You can also use the a element to create hyperlinks that navigate to different sections within the same HTML document. To do this, you need to add an id attribute to the section that you want to navigate to. Then, you can use the href attribute to specify the value of the id attribute as the URL of the link. For example, the following code creates a hyperlink that navigates to the section with the ID my-section:
When you place more than 12 grid columns in a single row, the extra grid columns will wrap in a new line. For example, the following code creates a row with 15 columns: HTML
This is the first column. This is the second column. This is the third column. This is the fourth column. This is the fifth column.
The first four columns will be displayed on the first line, and the fifth column will be displayed on the second line. Responsive Breakpoints: Bootstrap provides different Bootstrap Grid Column class name prefixes for five responsive tiers (responsive breakpoints). These breakpoints are used to define how the layout will be displayed on different screen sizes. The five responsive tiers are:
CSS Box Properties: The CSS box properties define the margins, padding, and borders of an HTML element. Margin: The margin property defines the space between the element's border and the adjacent elements or the edge of the viewport. Padding: The padding property defines the space between the element's content and its border. Border: The border property defines the lines that surround the element. Bootstrap Spacing Utilities: Bootstrap provides a number of CSS class names that can be used to quickly and easily set the margins, padding, and borders of an HTML element. Margin Utilities: The margin utilities are prefixed with m-. The asterisk () symbol can be any number in the range of 0 to 5. For example, m- defines a margin of 5 pixels. Padding Utilities: The padding utilities are prefixed with p-. The asterisk () symbol can be any number in the range of 0 to 5. For example, p- defines a padding of 3 pixels. Background Color Utilities: The background color utilities are prefixed with bg-. You can use one of the following Bootstrap class names to apply a background color to an HTML element:
Contact
The nav element is the container element for the navbar. The ul element is used to list the links in the navbar. The li element is used to represent a single link in the navbar. The a element is used to create a hyperlink. The nav element has the following CSS properties:
elements that have a class of "paragraph": .paragraph
element that has an ID of "populationParagraph": #populationParagraph Type (Tag Name) Selectors: Type (tag name) selectors are used to select HTML elements based on their tag name. For example, the following selector selects all the
elements: p Attribute Selectors: Attribute selectors are used to select HTML elements that have a specific attribute. For example, the following selector selects all the
elements that have an id attribute with the value of "populationParagraph": [id="populationParagraph"] Universal Selectors: The universal selector is represented by an asterisk (*). It is used to select all HTML elements. For example, the following selector selects all the HTML elements: * Pseudo-classes: Pseudo-classes are used to select HTML elements based on their state or condition. For example, the following selector selects all the
elements that are currently active: p:active Compound Selectors: Compound selectors are used to combine multiple selectors. For example, the following selector selects all the
elements that have a class of "paragraph" and are currently active: .paragraph:active Complex Selectors: