Survival Rate Calculator
This calculator helps estimate the survival rate of a population over a specific period. It's commonly used in fields like ecology, medicine, and biology to understand population dynamics and treatment efficacy.
" +
"Initial Population: " + initialPopNum.toLocaleString() + "" +
"Survivors: " + survivorsNum.toLocaleString() + "" +
"Time Period: " + timePeriod + "" +
"Calculated Survival Rate: " + survivalRate.toFixed(2) + "%" +
"
";
}
.survival-calculator-container {
font-family: sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-form h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.calculator-form p {
text-align: justify;
margin-bottom: 30px;
color: #555;
line-height: 1.6;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.form-group input[type="number"],
.form-group input[type="text"] {
width: calc(100% – 20px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Important for padding + width */
}
.form-group input[type="number"]:focus,
.form-group input[type="text"]:focus {
border-color: #007bff;
outline: none;
}
.calculator-form button {
width: 100%;
padding: 12px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.calculator-form button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 30px;
padding: 20px;
border: 1px dashed #007bff;
border-radius: 4px;
background-color: #e7f3ff;
}
.result-item {
text-align: center;
}
.result-item p {
margin-bottom: 10px;
color: #333;
line-height: 1.5;
}
.result-item .highlight {
font-weight: bold;
color: #28a745; /* Green for positive outcome */
font-size: 1.1em;
}
.error {
color: #dc3545; /* Red for errors */
font-weight: bold;
}