Cubic Feet Calculator
This calculator helps you determine the volume of a rectangular prism in cubic feet. Cubic feet (ft³) is a unit of volume, commonly used to measure the space occupied by an object or the capacity of a container. It's particularly useful in construction, shipping, and for understanding the dimensions of rooms or storage spaces.
Calculate Cubic Feet
.calculator-container {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-title {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.calculator-description {
color: #555;
line-height: 1.5;
margin-bottom: 20px;
}
.calculator-inputs {
margin-bottom: 20px;
}
.input-group {
margin-bottom: 15px;
}
.input-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.input-group input {
width: calc(100% – 22px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
}
.calculator-button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 1.1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
background-color: #e9ecef;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 1.2rem;
text-align: center;
color: #007bff;
font-weight: bold;
}
function calculateCubicFeet() {
var lengthInput = document.getElementById("length");
var widthInput = document.getElementById("width");
var heightInput = document.getElementById("height");
var resultDiv = document.getElementById("result");
var length = parseFloat(lengthInput.value);
var width = parseFloat(widthInput.value);
var height = parseFloat(heightInput.value);
if (isNaN(length) || isNaN(width) || isNaN(height) || length <= 0 || width <= 0 || height <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all dimensions.";
resultDiv.style.color = "red";
return;
}
var cubicFeet = length * width * height;
resultDiv.innerHTML = "Volume: " + cubicFeet.toFixed(2) + " cubic feet (ft³)";
resultDiv.style.color = "#007bff";
}