Setting CSS global initial styles is mainly for ensuring compatibility across different browsers. Here’s an example:
/* Global Initial Styles */
html, body, div, span, h1, h2, h3, h4, h5, h6, a, em, img, p, dd, dl, dt, ul, li, ol, form, label, table, tr, td, input {
margin: 0;
padding: 0;
color: #333;
}
p {
font-size: 14px;
}
body {
width: 100%;
font-size: 12px;
font-family: "Microsoft YaHei", Arial, Helvetica, serif;
background-color: #f5f4f9;
}
a, a:link, a:visited {
text-decoration: none;
}
a:hover {
color: #e60012;
}
li {
list-style: none;
}
img {
border: none;
}
.clear {
clear: both;
}
If you’re using CSS frameworks like Bootstrap, LayUI, or Tailwind CSS, they’ve already set these global initial styles for you, so you don’t need to set them yourself.