Css Notes
Css Notes
* {
background-color: yellow;
}
div * {
background-color: yellow;
}
//Element selector
element {
css declarations;
}
p {
background-color: yellow;
}
element.class Selector
p.intro {
background-color: yellow;
}
element element selector
div p {
background-color: yellow;
}
//Group selectors
h1 { font-family: sans-serif }
h2 { font-family: sans-serif }
h3 { font-family: sans-serif }
is equivalent to:
h1 {
display: none;
}
p {
display: none;
}
visibility: hidden; hides the element, but it still takes up space in the layout.
Child element of a hidden box will be visible if their visibility is set to
visible.
display: none; turns off the display and removes the element completely from the
document. It does not take up any space, even though the HTML for it is still in
the source code. All child elements also have their display turned off, even if
their display property is set to something other than none.
div {
column-count: 3;
}
.newspaper {
column-count: 3;
column-gap: 40px;
column-rule: 1px solid lightblue;
}
h2 {
column-span: all;
}
/* This is a single-line comment */
<h1 style="background-color:DodgerBlue;">Hello World</h1>
<p style="background-color:Tomato;">Lorem ipsum...</p>
text color
body {
color: blue;
}
h1 {
color: green;
}
h1 {
background-color: black;
color: white;
}
h2 {
text-align: left;
}
h3 {
text-align: right;
}
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
The text-indent property is used to specify the indentation of the first line of a
text:
p {
text-indent: 50px;
}
h1 {
letter-spacing: 3px;
}
p.italic {
font-style: italic;
}
.p1 {
font-family: "Times New Roman", Times, serif;
}
h1 {
font-size: 40px;
}
h2 {
font-size: 30px;
}
/* unvisited link */
a:link {
color: red;
}
/* visited link */
a:visited {
color: green;
}
/* selected link */
a:active {
color: blue;
}
a:hover MUST come after a:link and a:visited
a:active MUST come after a:hover
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
<style>
ul.a {
list-style-type: circle;
}
ul.b {
list-style-type: square;
}
ol.c {
list-style-type: upper-roman;
}
ol.d {
list-style-type: lower-alpha;
}
ul {
list-style-image: url('sqpurple.gif');
}
//css tables
table, th, td {
border: 1px solid black;
}
table {
width: 100%;
}
The result of the query is true if the specified media type matches the type of
device the document is being displayed on and all expressions in the media query
are true. When a media query is true, the corresponding style sheet or style rules
are applied, following the normal cascading rules.
Unless you use the not or only operators, the media type is optional and the all
type will be implied.
body {
background-color: pink;
}
The width=device-width part sets the width of the page to follow the screen-width
of the device (which will vary depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first
loaded by the browser.