Colorful MATLAB Tool
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
header {
background-color: #333;
color: #fff;
text-align: center;
padding: 1rem;
}
main {
max-width: 600px;
margin: 0 auto;
padding: 2rem;
}
.calculator {
background-color: #fff;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 5px;
padding: 1rem;
text-align: center;
}
#calculator-screen {
width: 100%;
padding: 0.5rem;
font-size: 1.5rem;
text-align: right;
border: 1px solid #ccc;
margin-bottom: 1rem;
}
.calculator-buttons {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 0.5rem;
}
button {
padding: 0.5rem;
font-size: 1rem;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
border-radius: 5px;
}
button.operator {
background-color: #e83e8c;
}
button:hover {
background-color: #0056b3;
}
function appendToScreen(value) {
document.getElementById("calculator-screen").value += value;
}
function clearCalculator() {
document.getElementById("calculator-screen").value = "";
}
function calculate() {
const expression = document.getElementById("calculator-screen").value;
try {
const result = eval(expression);
document.getElementById("calculator-screen").value = result;
} catch (error) {
document.getElementById("calculator-screen").value = "Error";
}
}
Documentation
Step 1:- Open txt file from the folder for code
Step 2:- Copy all code
Step 3:- Open your website dashboard or blog
Step 4:- Add HTML element
Step 5:- Paste all code in your html element
Step 6:- Save file
Done you are successfully Pasted code in your website.
0 Comments