Complete CSS Stylesheet
CSS with colors, selectors, media queries, and animations - colors show inline preview boxes:
/* CSS Stylesheet Example */
:root {
--primary-color: #3498db;
--secondary-color: #2ecc71;
--danger-color: rgb(231, 76, 60);
}
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
padding: 30px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
/* Headings */
h1, h2, h3 {
color: #2c3e50;
margin-bottom: 15px;
}
h1 {
font-size: 2.5em;
border-bottom: 3px solid #3498db;
}
/* Buttons */
.btn {
display: inline-block;
padding: 10px 20px;
background-color: #3498db;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.btn:hover {
background-color: #2980b9;
}
.btn-success {
background: linear-gradient(135deg, #2ecc71, #27ae60);
}
.btn-danger {
background-color: rgba(231, 76, 60, 0.9);
}
/* Named colors */
.alert {
background-color: LightYellow;
border: 1px solid Gold;
color: DarkOrange;
padding: 15px;
}
.info {
background-color: AliceBlue;
border-left: 4px solid CornflowerBlue;
}
/* HSL colors */
.accent {
color: hsl(120, 100%, 50%);
background: hsla(240, 100%, 50%, 0.2);
}
/* Media queries */
@media screen and (max-width: 768px) {
.container {
padding: 15px;
}
h1 {
font-size: 2em;
}
}
/* Animations */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}
/* Pseudo-elements */
.quote::before {
content: '"';
color: #95a5a6;
}
/* Attribute selectors */
input[type="text"] {
border: 1px solid #bdc3c7;
padding: 8px;
}
input[type="submit"]:disabled {
opacity: 0.5;
cursor: not-allowed;
}