i
What Do You Mean By HTML and CSS?
Common HTML Terms
Creating HTML Document Structure
Common CSS Terms
Selectors
Referencing CSS
CSS Resets
Getting to Know HTML And Semantics Overview
Identifying Divisions and Spans
Using Text Based Element
Building Structure
Creating Hyperlinks
Getting to Know CSS :The Cascade
Calculating Specificity
Combining Selectors
Layering Styles With Multiple Classes
Common CSS Properties
CSS Aural Media/Style Sheets
CSS Pagination
CSS Overflow
CSS White Space
CSS Word Wrap
CSS Outline
CSS Visibility
CSS Counters
CSS Animation
CSS Transition
CSS Tooltips
CSS Tooltip Animation
CSS Arrow
CSS Flexbox
CSS Media Queries
CSS 2D Transforms
CSS 3D Transforms
How are Elements Displayed?
Display Property Controls And Box Model?
Working With Box Model
Width and Height
Margins and Padding
Borders, Individual Border Sides, Border Radius, Box Sizing, Content Box and Padding Box
Developer Tools
Removing Spaces between Inline-Block Elements
Positioning With Floats
Floats in Practice
Positioning With Inline-Block
Clearing and Containing Floats
Creating Reusable Layouts
Uniquely Positioning Layouts
Adding Colour To Text
Changing Font Properties
Font Family
Font Size, Font Style, Font Variant, Font Weight And Line Height
Shorthand Font Properties
Applying Text Properties
Text Properties All Together
Using Web-Safe Fonts
Including Citation And Quotes
Adding A Background Colour
Adding a Background Image and Background Repeat
Background Position and Shorthand Background Image Values
Designing Gradient Backgrounds
Changing the Direction of a Gradient Background
Using Multiple Background Images
Exploring New Background Properties
Unordered Lists
Ordered Lists
Description Lists
Nested Lists
List Item Styling
List Style Type Values
List Style Position Property
Adding Media And Adding Images
Sizing Images
Positioning Images, Inline Positioning Images, Blocking Positioning Images , Positioning Images Flush Left or Right
Adding Audio
Adding Videos
Adding Inline Frames
Semantically Identifying Figures And Captions
Building Forms And Initializing a Form
Text Fields And Text Areas
Multiple Choice Inputs And Menus
Form Buttons
Other Inputs
Organizing Form Element
Form And Input Attributes
Login Form Example
Organizing Data with Tables
Creating A Table
Table Header
Table Structure
Table Head, Body and Foot
Combining Multiple Cells
Table Borders
Table Striping
Aligning Text
Completely Styled Table
HTML Coding Practices
Use the Proper Document Structure
Keeping the Syntax Organized
Use Practical ID and Class Values
CSS Coding Practices
Write CSS Using Multiple Lines and Spaces
Use Proper Class Names
Build Proficient Selectors
Use Desired Classes When Needed
Use Shorthand Hexadecimal Color Values
Drop Units Zero Values
HTML abbr tag
HTML acronym tag (Not for HTML 5)
HTML area tag
HTML basefont tag
HTML blockquote tag
HTML datalist tag
HTML Description List
HTML ins tag
Marquee HTML Tag
HTML object tag
HTML picture tag
HTML SVG
We have used several CSS property values above such as the colour values, i.e. green, red and orange. Now in this section, we are going to learn some previously used property values as well as will be learning new ones. Mainly we are going to look on properly values that are linked with colour as well as length measurements.
Colours
Every colour used in CSS is characterized by an sRGB (standard red, green and blue) colour space. Other colours can be generated by mixing red, green and blue together, in the same manner as done by monitors and television. By doing so, we can make millions of colour.
Presently there are four fundamental ways to represent sRGB colours in CSS. They are by keywords, by hexadecimal notation, by RGB values and by HSL values.
Keyword Colors
In simple words, Keyword colour values are names that point a particular colour. The CSS controls these keyword names and their comparing hues. Let's take an example of this.
mask {
background: green;
}
.last {
background: orange;
}
In the above code, we are providing a green background to an element with 'mask' class attribute value and an orange background is assigned to any element having 'last' as class attribute value.
The way of assigning colour using the Keyword colour values is simplest. They provide the user with a limited option and is not a right colour value choice to use.
Hexadecimal Colors
Hexadecimal colour values contain a hash (#) sign which is followed by 3 to 6 character figure. The figures are made up of letters from a to f (both lowercase and Uppercase) and numbers from 0 to 9. The values point to red, green and blue colours.
In the 3 figure notation, the 1st character refers to the red channel, the 2nd one refers to the green channel, and the last one refers to the blue channel. In the 6 figure notation, the 1st two refers to the red channel, 3rd and 4th refer to the green channel, and the leftover figure (5th and 6th) refers to the blue channel.
If you have got a 6 figure notation where the first two characters are a matching pair, the 3rd and 4th is also a matching pair, and the last two is also a matching pair then that 6 figure notation can be converted to a three-character notation. To form it use the repeated character once. Let's say; #ff6600 represents an orange colour in hexadecimal colour. This can also be written as #f60.
These character pairs can be found out by changing over 0 through 255 into a base-16. The math is somewhat dubious—and deserving of its book—however, it realizes that 0 equivalents black and f is for white.
.task {
background: #800000;
}
.count {
background: #ff0;
}
Thus, the hexadecimal code for maroon is #800000, and that of yellow is #ff0. So putting them as the property value will help us to get that colour.
Hexadecimal colour is a popular way of expressing colour in CSS as they provide the developer with a lot of options. But still, they are a bit hard to use, especially if you have no idea regarding it. Luckily Adobe has made Adobe Kuler, a free application that gives a shading wheel to assist us with finding any shading we need and its compared hexadecimal value. Also, most picture altering applications, for example, Adobe Photoshop, give the capacity to find hexadecimal shading values.
RGB & RGBa Colors
RGB value colours are assigned using the rgb() functions (Red, Green and Blue). The mentioned function takes three inputs separated by a comma. The inputs are only integers from 0 to 255. A value of 255 is pure white, while a value of 0 is fully black.
It is understood that the first value in the rgb() function is for the red channel, the 2nd one is for the green channel and the 3rd one is for the blue channel.
If you want to make an orange color, then it should be rgb (255, 102, 0).
.task {
background: rgb(128, 0, 0);
}
.count {
background: rgb(255, 255, 0);
}
RGB color values might also contain an transparency, or alpha, by utilizing the rgba() function. The rgba() need one more value which is a number between 0 and 1(decimals included). 0 creates a full transparent color (invisible) while 1 creates an opaque color. Any decimal value will create a semi-transparent color.
Suppose you want a 50% opaque orange colour then you can write as – rgba(255, 102, 0, .5).
Example -
.task {
background: rgba(128, 0, 0, .25);
}
.count {
background: rgba(255, 255, 0, 1);
}
Now a days this RGBa feature is getting very much popular.
HSL & HSLa Colors
HSL colour value is given using the hsl() function (Hue, Saturation, and Lightness). The function takes in 3 values separated by commas just like rgb().
The 1st value, i.e. Hue, is a number from 0 to 360. The numbers 0 through 360 defines the shading wheel.
The 2nd and the 3rd value are for saturation and the lightness, respectively. They are represented as a percentage from 0 to 100. Here 100 per cent means the colour is fully saturated, and 0 means the colour is entirely black. Same way 0, as the lightness value, says that the colour is entirely black and 100 per cent says that the colour is white.
Example –
.task {
background: hsl(0, 100%, 25%);
}
.count {
background: hsl(60, 100%, 50%);
}
HSL color values might also contain an transparency, or alpha, by utilizing the hsla() function. The hsla() need one more value which is a number between 0 and 1(decimals included) which identifies the degree of opacity.
Example -
.task {
background: hsla(0, 100%, 25%, .25);
}
.count {
background: hsla(60, 100%, 50%, 1);
}
In the above code 0.25 denotes a 25 percent opacity while 1 denotes 100 percent opacity.
Lengths
There are several values for length, and all of them are used for different purpose. The values of length can be categorized into two types, one is absolute, and the other one is relative. We're going to adhere to the most typical—and increasingly clear—values right now, as progressively complex qualities will give substantially more power than we require for now.
Absolute Lengths
Absolute length values are one of the most straightforward values as they refer to physical measurements like centimetres, inches or millimetres. The most common unit of measurement which comes under this category is pixel which is represented by px notation.
Pixels
An inch is made up of 96 pixels. The definite estimation of a pixel may fluctuate somewhat between low density and high-density gadgets. Example –
p {
font-size: 14px;
}
In the above code the paragraph has a pixel size of 14px.
Pixels have lost most of its popularity only because of devices coming with varying screens. As they are an absolute unit of measurement, they do not offer much-needed flexibility. If you are getting started with HTML, then the pixel is excellent to use.
Relative Lengths
Relative length values are somewhat more confounded, as they are not a fixed units of estimation; they depend on the length of another estimate.
Percentage
Percentage is one of the most popular relative values. Percentage lengths are characterized in connection to the length of another object. Let’s suppose to provide a width of 50 per cent to an element; we need to know the breadth of its parent element within which it is nested.
Example -
col {
width: 50%;
}
Em
The unit of em is also a popular one. It is represented by 'em', and the length is determined using the font size of the element.
A single em is said to be equivalent to the font size of an element. Let’s say that the element’s font size is 14 pixel and has a width of 5em then the width is equal to 70 pixels (14 X 5).
Example –
.banner {
font-size: 14px;
width: 5em;
}
Apart from the above mentioned absolute and relative units of length, CSS has a lot more options. But pixels, percentage and em units are used the most.
Don't miss out!