First Button : For Type Name Id
First Button : For Type Name Id
First button
id: unique identifier for any element every element should have a different id
For the responsive design certificates- Building a
product landing page: use editor X inspiration
HTML To start and close tags we use <h1>—-> heading tag h1 largest heading and h6 smallest heading
The lorem ipsum text is randomly scraped from a famous passage by Cicero of Ancient Rome. Lorem
ipsum text has been used as placeholder text by typesetters since the 16th century, and this tradition
continues on the web.
Comments in HTML start with <!-- and end with a -->eg: <!— Hello Comment -->
These are placed around html elements and not within the elements
HTML5 introduces more descriptive HTML tags. These include main, header, footer, nav, video, article,
section and others.
Main Tag- Helps with SEO of the website, be sure to include main content within the main tag
These tags give a descriptive structure to your HTML, make your HTML easier to read, and help with
Search Engine Optimization (SEO) and accessibility. The main HTML5 tag helps search engines and
other developers find the main content of your page.
Nesting of two P elements implies that you need to include <p> 1 </p> and <p> 2 </p> both of them
Adding images <img src=“source.jpg” alt=“Alternative name for the image in case the image fails to
load”>
Inserting Images:
Anchor elements can help you redirect to other URLs anchor element—> a (they need a destination web
address called an href attribute. They also need anchor text <a
href=“https://www.freecodecamp.org"> this is the link to freecodecamp.org </a>
Linking to internal sites on the same page using anchor <a href=“#contacts-header”>Contacts</a>
target="_blank" attribute from the anchor tag since this causes the linked document to open a new window tab.
Creating ListsUnordered lists start with an opening <ul> element, followed by any number of <li>
elements. Finally, unordered lists close with a </ul>.
input elements are a convenient way to get input from your user.
<input type=”text” placeholder=”this text displays itself inside the input field”> (these tags are
self closing)
To make the input field required add ”required” <input type= “text” required>
<button type= “submit”> this button submits the text within the input field </button>
<Label> tag
The <label> tag literally gives labels to various elements such as radio buttons and checkboxes,
etc
It acts a label maker
Checkbox buttons (lets users select n options- out of n: used for questions with more than 1
answers)
1. Defining the button function input in a button would be <input type= “radio” name=”fav”
id= “button”>
Note: SAME NAMES USED TO ALLOW USER TO SELECT ONLY ONE OPTION. ALWAYS USE
DIFFERENT IDs, otherwise it will confuse the system
1. <label>
<input type= “radio” name= “1” id= “1”> Indoor </label>
Value attribute- data collected from buttons gets a “value” and submitted response gets sorted
<input type= “radio” value= “indoor” name= “1” id= “ch1” checked>
Division element elements contained inside the <div> </div> tags can be stylized with CSS
and JavaScript later on
.myDiv {
border: 5px outset red; background-colour: lightblue; text-align: center;
}
<div class=”myDiv”> <!—give attention to the capital “D” in both the tags
<p> div class stylized </p> </div
HTML is an evolving language and you need to tell the browser which version of HTML you are
using, to tell the browser that we are using HTML 5 we use html <!DOCTYPE html>
Note: You need to add <html> and </html> tags
CSS Basics
Changing text color
<style>
h2 {color: red; font-size: 30px ; font-family: sans-serif} due to h2 written only texts within
h2 tags throughout the code will be
</style>
Font-size
color
Font-family
<h2> Only those texts within h2 tags will be colored red or stylized with the CSS class </h2>
Element selector for CSS: If you create a style class for h2{}, p{} , etc this means only text
contained within these tags will automatically get stylized without writing anything else.
For eg <p> </P> all text within these two tags will automatically get stylized just by
enclosing the text within these tags
Importing texts: While importing texts family names are case-sensitive and to be
wrapped in quotes if there is a space in the name
For eg- you need quotes to use “open sans” but no quotes needed to use Lobster
Insert URL of the custom text you want to use from Google Fonts Library before style tag
(Keep in mind the comma between the two fonts and ; after the generic name)
font-family: FAMILY_NAME, GENERIC_NAME; Family names are case sensitive and generic
names are alternatives which show up in case the family name is not loading
CSS classes (We can use multiple classes for an element by separating the classes with a space)
<img class= “class1 class2”>
<style>
h2 {color: red; font-size: 16px; font-family: “open sans”; }
</style>
Image manipulation
.smaller-image {width:100px; }
border-radius: 10px;
If border radius is set in pixels the sharp edges are rounded but if the border radius is set in %
the image is made circular
border-radius: 50%;
Note that inside your style element, you always reference classes by putting a . in front of their
names. You always reference ids by putting a # in front of their names.
If conflict between class and id in <style> computer prefers properties attached with id
<style>
#cat-photo-app
{ background-color: silver;}
</style>
Padding
You may have already noticed this, but all HTML elements are essentially little rectangles.
Three important properties control the space that surrounds each HTML element:
padding, border, and margin.
Padding: An element's padding controls the amount of space between the element's content
and its border.
--- CSS allows you to control the padding of all four individual sides of an element with the
padding-top, padding-right, padding-bottom, and padding-left properties.
(same goes for margins)
Margin: An element's margin controls the amount of space between an element's border and
surrounding elements.
PICTURE 1: (above)
for the blue box, margin: 20px;
Picture 2:
for the blue box margin: -25px;
Easy to way to edit all the attributes at once following code will change the margin of all
radio attributes to have a margin of 10px
[type=’radio’]
{ margin: 10px;}
Relative units- em, rem ?
this code will make the whole page black in colour, all the elements on the page, eg- text, will
be green in colour, all the text will be Monospace
adding a class which asks some text to be pink will make the text pink
(command from body attribute < command from CSS class)
Adding another class eg <h1 class= “pink-text blue-text”> will make the text blue </h1>
The browser uses whichever CSS class comes at last. Browser reads the CSS classes top to
bottom.
In many situations, you will use CSS libraries. These may accidentally override your own CSS. So
when you absolutely need to be sure that an element has specific CSS, you can use !important.
CSS Variables
CSS Variables are a powerful way to change many CSS style properties at once by changing only
one value.
To create a CSS variable, you just need to give it a name with two hyphens in front of it and
assign it a value like this:
--penguin-skin: gray;
Applied as
background: var(--penguin-skin); (Traditionally applied as background-color: black;)