CSS
Frontend
Insert CSS
Three ways to insert css:
- External style sheet
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
- Internal style sheet
<head>
<style>
h1, h2 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
-
Inline style
An inline style may be used to apply a unique style for a single element.
<h1 style="color:blue;margin-left:30px;">This is a heading</h1>
提示
In vue, to add multiple class, this way is commended:
<p :class="['thin', 'color']"> something </p>
Multiple Style Sheets
If some properties have been defined for the same selector (element) in different style sheets, the value from the last read style sheet will be used.
An inline style has the highest priority, and will override external and internal styles and browser defaults.
<style>
h1 {
color: orange;
}
h1 {
color: red;
}
</style>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<!-- Sequence: orange - red - style in 'mystyle.css'. -->
colors
- RGB Value
(red, greenm blue), such asrgb(60, 179, 113) - HEX Value (
#ff0000) - HSL Value:
hsl(hue, saturation, lightness)
<h3 style="background-color:hsl(300, 76%, 72%);">hsl(300, 76%, 72%)<h3>
-
RGBA Value
(red, green, blue, alpha)aplha parameter is a number between 0.0 (fully transparent) and 1.0 (not transparent at all)
-
HSLA Value
hsla(hue, saturation, lightness, alpha)
修改历史9 次提交
- refactor: reorganize documentation structure and update Navbar componentxiaocheng··
2fb8f42 - chore(project): clean up obsolete configuration and build artifactsxiaocheng··
3574bd3 - new struct for lblogsxiaocheng··
8c9b28e - move blogs to docsxiaocheng··
c8535a0 - update codechenweigao··
e4c6887 - update fix: timeline errorchenweigao··
fb4b591 - update Datechenweigao··
3c14689 - init v3chenweigao··
b770fc2 - init v2chenweigao··
505f81b