This calculator helps you estimate the weight of a granite slab based on its dimensions. Granite is a common igneous rock known for its durability and aesthetic appeal, often used in countertops, flooring, and monuments. Its density can vary slightly, but a typical value is around 2.7 grams per cubic centimeter (or 168.5 pounds per cubic foot).
function calculateGraniteWeight() {
var length = parseFloat(document.getElementById("length").value);
var width = parseFloat(document.getElementById("width").value);
var thickness = parseFloat(document.getElementById("thickness").value);
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = "; // Clear previous results
if (isNaN(length) || isNaN(width) || isNaN(thickness) || length <= 0 || width <= 0 || thickness <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for all dimensions.";
return;
}
// Convert thickness from inches to feet
var thicknessInFeet = thickness / 12;
// Calculate volume in cubic feet
var volumeCubicFeet = length * width * thicknessInFeet;
// Approximate density of granite in pounds per cubic foot
// Typical density range is 165-170 lbs/cu ft. We'll use 168.5 lbs/cu ft.
var densityLbsPerCubicFoot = 168.5;
// Calculate weight in pounds
var weightLbs = volumeCubicFeet * densityLbsPerCubicFoot;
// Display the result
resultDiv.innerHTML = "Estimated Granite Weight: " + weightLbs.toFixed(2) + " lbs";
}
.granite-weight-calculator {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
background-color: #f9f9f9;
}
.granite-weight-calculator h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.granite-weight-calculator p {
line-height: 1.6;
color: #555;
text-align: justify;
}
.calculator-inputs {
margin-top: 20px;
display: grid;
grid-template-columns: 1fr;
gap: 10px;
}
.calculator-inputs label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.calculator-inputs input[type="number"] {
width: calc(100% – 22px); /* Adjust for padding and border */
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.calculator-inputs button {
padding: 10px 15px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
margin-top: 10px;
}
.calculator-inputs button:hover {
background-color: #45a049;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #e0e0e0;
background-color: #fff;
border-radius: 4px;
text-align: center;
font-size: 1.1em;
}
.calculator-result strong {
color: #007bff;
}