How to website post background colorful ?
SEO Help and Tips
How to website post background colorful ?
Use this example code on your website template <head> and <body>
Example Code:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Main View with Different Post Backgrounds</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2; /* Set a background color for the entire page */
}
.post {
margin: 10px;
padding: 20px;
border-radius: 8px;
color: #333;
background-color: #fff; /* Default background color for posts */
box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
.post:nth-child(odd) {
background-color: #e0f7fa; /* Change background color for odd-numbered posts */
}
.post:nth-child(even) {
background-color: #ffcdd2; /* Change background color for even-numbered posts */
}
</style>
</head>
<body>
<div class="post"> <!-- Post 1 -->
<h2></h2
<p>Content of Post</p>
</div>
<div class="post"> <!-- Post 2 -->
<h2>Post Title 2</h2>
<p>Content of Post 2...</p>
</div>
<div class="post"> <!-- Post 3 -->
<h2>Post Title 3</h2>
<p>Content of Post 3...</p>
</div>
</body>
</html>
Comments
Post a Comment
Thanks for your Comments.