Sheet_CSS
Sheet_CSS
CSS
CHEAT SHEET
CSS
CSS (Cascading Style Sheets) is a stylesheet language used for
describing the look and formatting of a document written in HTML
(Hypertext Markup Language).
CSS is used to define the layout, font, color, and other visual
aspects of a webpage, and it helps to separate the content of a
webpage from its presentation. CSS allows you to apply styles to
multiple HTML elements at once, and it makes it easy to maintain
and update the styling of a webpage.
You can use CSS to specify styles for different devices, such as
desktop computers, tablets, and mobile phones, which makes it
easier to create responsive designs that look good on any device.
To use CSS, you can include a stylesheet in your HTML document
using a <link> element, or you can use inline styles in your HTML
elements using the style attribute.
You can also use CSS to style elements in other documents, such
as XML or SVG, and you can use CSS in combination with other
technologies, such as JavaScript, to create dynamic and
interactive webpages.
2 | Page
FONT PROPERTIES IN CSS
The font has many properties that you can change, such as its
face, weight, and style, which allow you to alter the appearance of
your text.
• Font-Family: Specifies the font family of the text.
• Font: A shorthand property for specifying the font-style, font
variant, font-weight, font-size/line-height, and font-family
properties all at once.
• Font-Size: Specifies the font size of the text.
p{
font-family: Times, serif, Arial, Helvetica, sans-serif;
font: 15px Helvetica, sans-serif, Arial;
font-size: 15px;
font-weight: bold;
font-style: italic;
font-variant: small-caps;
}
3 | Page
TEXT PROPERTIES IN CSS
CSS has a lot of properties for formatting text.
p{
text-align: center;
text-decoration: underline;
letter-spacing: 5px;
text-transform: uppercase;
word-spacing: 8px;
text-indent: 40px;
line-height: 40%;
text-shadow: 4px 4px #ff0000;
}
4 | Page
BACKGROUND PROPERTIES IN CSS
5 | Page
body {
background-image: url(‘codeHelp.png’);
background-size: auto;
background -position: center;
background -repeat: no-repeat;
background -color: #ffffff;
background -attachment: fixed;
background -origin: content-box;
background : url(‘codeHelp.png’);
6 | Page
• Border: A shorthand property for border-width, border-style
and border-color.
div {
border-width: 4px;
border-style: solid;
border-radius: 4px;
border-color: #000000;
border: 20px dotted coral;
border-spacing: 20px;
}
7 | Page
Height: It sets the height of an element.
element's box.
p{
padding: 10px 20px 10px 20px;
visibility: hidden;
display: inline-block;
height: auto;
width: 100px;
float: right;
clear: left;
margin: 20px 10px 20px 10px;
overflow: scroll;
}
8 | Page
COLORS PROPERTIES IN CSS
The color property can be used to add color to various
objects.
{
color: rgb(0, 0, 0);
outline-color: #000000;
caret-color: coral;
opacity: 0.8;
}
9 | Page
LAYOUT PROPERTIES IN CSS
It defines the appearance of the content within a template.
10 | Page
{
box-align: start;
box-direction: normal;
box-flex: normal;
box-orient: inline;
box-sizing: margin-box;
box-pack: justify;
min-width: 200px;
max-width: 400px;
min-height: 100px;
max-height: 1000px;
11 | Page
• Table-Layout: It defines the algorithm used to layout table
cells, rows, and columns.
{
border-spacing: 4px;
border-collapse: separate;
empty-cells: show;
caption-side: bottom;
table-layout: auto;
}
12 | Page
• Column-Width: It specifies the column width.
{
column-gap: 4px;
column-rule-width: medium;
column-rule-color: #000000;
column-rule-style: dashed;
column-count: 20;
column-span: all;
column-width: 4px;
}
13 | Page
{
list-style-image: url(‘codeHelp.png’);
list-style-position: 10px;
list-style-type: square;
marker-offset: auto;
}
the
animation of other media elements on a web page.
14 | Page
• Animation-Play-State: It specifies whether the animation is
running or paused.
{
animation-name: anime;
animation-delay: 4ms;
animation-duration: 10s;
animation-timing-function: ease;
animation-iteration-count: 5;
animation-fill-mode: both;
animation-play-state: running;
animation-direction: normal;
}
15 | Page
• Transition-Timing-Function: It specifies the speed curve of
the transition effect.
{
transition-property: none;
transition-delay: 4ms;
transition-duration: 10s;
transition-timing-function: ease-in-out;
}
CSS FLEXBOX
Flexbox is a CSS layout system that makes it easy to align and
distribute items within a container using rows and columns. It
allows items to "flex" and adjust their size to fit the available
space, making responsive design simpler to implement. Flexbox
makes formatting HTML elements more straightforward and
efficient.
PARENT PROPERTIES:
16 | Page
• Justify-Content: It specifies the alignment between the items
inside a flexible container when the items do not use all
available space.
{
display: flex;
flex-direction: row | row-reverse | column | column-reverse;
flex-wrap: nowrap | wrap | wrap-reverse;
flex-flow: column wrap;
justify-content: flex-start | flex-end | center | space-between | space-
around | space-evenly | start | end | left | right ... + safe | unsafe;
align-items: stretch | flex-start | flex-end | center | baseline | first
baseline | last baseline | start | end | self-start | self-end + ... safe |
unsafe;
align-content: flex-start | flex-end | center | space-between | space-
around | space-evenly | stretch | start | end | baseline | first baseline |
last baseline + ... safe | unsafe;
}
17 | Page
CHILD PROPERTIES:
{
order: 2; /* By default it is 0 */
flex-grow: 5; /* By default it is 0 */
flex-shrink: 4; /* By default it is 1 */
flex-basis: | auto; /* By default it is auto */
align-self: auto | flex-start | flex-end | center | baseline | stretch;
flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ];
}
18 | Page
CSS GRID
The Grid layout is a 2-dimensional system in CSS that allows for
the creation of complex and responsive web design layouts with
consistent results across different browsers. It makes it easier to
build these types of layouts.
PARENT PROPERTIES:
19 | Page
Grid-Gap: It is a shorthand property for the grid-row-gap
and grid-column-gap properties.
20 | Page
{
display: grid | inline-grid;
grid-template-columns: 10px 10px 10px;
grid-template-rows: 5px auto 10px;
grid-template: none | <grid-template-rows> / <grid-template-
columns>;
column-gap: <line-size>;
row-gap: <line-size>;
grid-column-gap: <line-size>;
grid-row-gap: <line-size>;
gap: <grid-row-gap> <grid-column-gap>;
grid-gap: <grid-row-gap> <grid-column-gap>;
align-items: start | end | center | stretch;
justify-content: start | end | center | stretch | space-around | space-
between | space-evenly;
align-content: start | end | center | stretch | space-around | space-
between | space-evenly;
grid-auto-columns: <track-size>;
grid-auto-rows: <track-size>;
grid-auto-flow: row | column | row dense | column dense;
21 | Page
CHILD PROPERTIES:
22 | Page
{
grid-column-start: <number> | <name> | span <number> | span
<name> | auto;
grid-column-end: <number> | <name> | span <number> | span
<name> | auto;
grid-row-start: <number> | <name> | span <number> | span <name> |
auto;
grid-row-end: <number> | <name> | span <number> | span <name> |
auto;
grid-column: <start-line> / <end-line> | <start-line> / span <value>;
grid-row: <start-line> / <end-line> | <start-line> / span <value>; grid-
area: <name> | <row-start> / <column-start> / <row-end> / <column-
end>;
align-self: start | end | center | stretch;
23 | Page