There are a few CSS statements that I couldn’t get to work, but these are some CSS statements that I learned through W3Schools are:
1.Translate
div {
translate: 100px 20px;
} which allows the element to be changed along the x,y, and z axis.
2.Transition-Delay
div {
transition-delay: 2s;
} this notifys the elements when to start
3. Text-decoration-color
p {
text-decoration: underline;
text-decoration-color: red;
} this lets the underline or inline of the text to be a specific color.
4. Tab- size
pre {tab-size: 16;} this creates the space for every tab character used.
5. @property- this lets the css run without bumping into any Javascript.
@property –startColor {
syntax: “<color>”;
initial-value: #EADEDB;
inherits: false;
}
@property –endColor {
syntax: “<color>”;
initial-value: #BC70A4;
inherits: false;
}
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Color Changing Button</title>
<link rel=”stylesheet” href=”styles.css”>
</head>
<body>
<div class=”container”>
<button onclick=”changeColor()”>Click Me</button>
</div>
<script src=”script.js”></script>
</body>
</html>
selector body {
font-family: ‘Arial’, sans-serif;
margin: 0;
padding: 0;
justify-content: center;
align-items: center;
height: 300vh;
background-color: #f0f0f0;
}
selector .container {
text-align: center;
}
selector button {
background-color: #007BFF;
color: white;
border: none;
padding: 20px 40px;
font-size: 2em;
border-radius: 10px;
}
.cursor {
cursor: pointer;
}
selector button:hover {
background-color: #0056b3;
}
<script>
function changeColor(button) {
const colors = [
‘rgb(155, 162, 97)’,
‘rgb(231, 111, 81)’,
‘rgb(42, 157, 143)’,
‘rgb(38, 70, 83)’,
‘rgb(233, 196, 106)’,
‘rgb(255, 192, 203)’,
‘rgb(255, 127, 80)’
];
let currentColor = window.getComputedStyle(button).backgroundColor;
const randomColor = colors[Math.floor(Math.random() * colors.length)];
if (randomColor === currentColor) {
return changeColor(button);
}
button.style.backgroundColor = randomColor;
}
</script>