User:Sur/vector.css: Difference between revisions
< User:Sur
m hover shift mobile support test |
Tag: Undo |
||
Line 1: | Line 1: | ||
.stat-box { | |||
width: 100px; | |||
height: 150px; | |||
background-color: #f0f0f0; | |||
border-radius: 10px; | |||
text-align: center; | |||
position: relative; | |||
transition: width 0.3s ease; | |||
display: flex; /* Flexbox on the container */ | |||
flex-direction: column; /* Stack elements vertically */ | |||
justify-content: center; /* Center content vertically */ | |||
align-items: center; /* Center content horizontally */ | |||
} | |||
.stat-box:hover { | |||
width: 175px; | |||
} | |||
.stat-box-content { | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: center; | |||
align-items: center; | |||
border-radius: 15px; | |||
height: 100%; | |||
width: 100%; | |||
text-align: center; | |||
} | |||
.stat-box-icon { | |||
width: 40px; | |||
height: 40px; | |||
} | |||
.stat-box-label { | |||
margin-top: 10px; | |||
font-size: 16px; | |||
font-weight: bold; | |||
text-align: center; /* Ensure text is centered */ | |||
} | |||
.stat-box-hover { | .stat-box-hover { | ||
display: none; | display: none; | ||
position: absolute; | position: absolute; | ||
top: 0; | top: 0; | ||
left: 175px; /* This | left: 175px; /* This may need adjustment for small screens */ | ||
background-color: #fff; | background-color: #fff; | ||
border: 1px solid #ccc; | border: 1px solid #ccc; | ||
Line 9: | Line 50: | ||
padding: 10px; | padding: 10px; | ||
transition: opacity 0.3s ease, transform 0.3s ease; | transition: opacity 0.3s ease, transform 0.3s ease; | ||
border-radius: 15px; | border-radius: 15px; /* Ensure border radius matches background radius */ | ||
z-index: 1 | z-index: 1; /* Ensure the hidden box appears above other content */ | ||
} | } | ||
.stat-box:hover .stat-box-hover { | .stat-box:hover .stat-box-hover { | ||
display: block; | display: block; | ||
opacity: 1; | opacity: 1; /* Ensure the box fades in smoothly */ | ||
transform: translateX(0); | transform: translateX(0); /* Adjust positioning on hover */ | ||
} | } | ||
@media (max-width: 768px) { | @media (max-width: 768px) { | ||
.hover-box { | |||
width: 80px; | |||
height: 120px; | |||
} | |||
.hover-box:hover { | |||
width: 140px; | |||
} | |||
.stat-box-hover { | .stat-box-hover { | ||
left: 140px; /* Adjust the left position for smaller screens */ | left: 140px; /* Adjust the left position for smaller screens */ | ||
font-size: 14px | font-size: 14px; /* Smaller font size for better fit */ | ||
} | } | ||
} | } | ||
@media (max-width: 480px) { | @media (max-width: 480px) { | ||
.hover-box { | |||
width: 60px; | |||
height: 90px; | |||
} | |||
.hover-box:hover { | |||
width: 120px; | |||
} | |||
.stat-box-hover { | .stat-box-hover { | ||
left: | left: 120px; /* Adjust the left position for very small screens */ | ||
font-size: 12px; | font-size: 12px; /* Smaller font size for very small screens */ | ||
padding: 8px | padding: 8px; /* Adjust padding for small screens */ | ||
} | } | ||
} | |||
.stat-box-table { | |||
width: 100%; | |||
border-collapse: separate; | |||
} | |||
.stat-box-table th, | |||
.stat-box-table td { | |||
padding: 5px; | |||
text-align: center; | |||
background-color: rgba(0, 0, 0, 0.08); /* Semi-transparent background */ | |||
border: 1px solid #ccc; | |||
white-space: nowrap; /* Prevent text wrapping */ | |||
overflow: hidden; /* Hide overflow */ | |||
text-overflow: ellipsis; /* Show ellipsis if content overflows */ | |||
position: relative; /* Ensure position is relative for blending */ | |||
} | |||
.stat-box-table td::before, | |||
.stat-box-table th::before { | |||
content: ''; /* Empty content for overlay */ | |||
position: absolute; | |||
top: 0; | |||
left: 0; | |||
width: 100%; | |||
height: 100%; | |||
background-color: rgba(0, 0, 0, 0.08); /* Darker translucent background */ | |||
mix-blend-mode: multiply; /* Blend the overlay with text */ | |||
z-index: 1; /* Ensure overlay is in front of text */ | |||
} | |||
.stat-box-table td, | |||
.stat-box-table th { | |||
position: relative; /* Ensure text stays below the overlay */ | |||
z-index: 0; /* Text stays behind the overlay */ | |||
} | |||
.stat-box-table th:first-child, | |||
.stat-box-table td:first-child { | |||
border-top-left-radius: 10px; | |||
border-bottom-left-radius: 10px; | |||
} | |||
.stat-box-table th:last-child, | |||
.stat-box-table td:last-child { | |||
border-top-right-radius: 10px; | |||
border-bottom-right-radius: 10px; | |||
} | |||
.stat-box-table .darker { | |||
background-color: rgba(0, 0, 0, 0.25); /* Slightly darker background */ | |||
} | } |
Revision as of 22:47, 15 September 2024
.stat-box {
width: 100px;
height: 150px;
background-color: #f0f0f0;
border-radius: 10px;
text-align: center;
position: relative;
transition: width 0.3s ease;
display: flex; /* Flexbox on the container */
flex-direction: column; /* Stack elements vertically */
justify-content: center; /* Center content vertically */
align-items: center; /* Center content horizontally */
}
.stat-box:hover {
width: 175px;
}
.stat-box-content {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 15px;
height: 100%;
width: 100%;
text-align: center;
}
.stat-box-icon {
width: 40px;
height: 40px;
}
.stat-box-label {
margin-top: 10px;
font-size: 16px;
font-weight: bold;
text-align: center; /* Ensure text is centered */
}
.stat-box-hover {
display: none;
position: absolute;
top: 0;
left: 175px; /* This may need adjustment for small screens */
background-color: #fff;
border: 1px solid #ccc;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
padding: 10px;
transition: opacity 0.3s ease, transform 0.3s ease;
border-radius: 15px; /* Ensure border radius matches background radius */
z-index: 1; /* Ensure the hidden box appears above other content */
}
.stat-box:hover .stat-box-hover {
display: block;
opacity: 1; /* Ensure the box fades in smoothly */
transform: translateX(0); /* Adjust positioning on hover */
}
@media (max-width: 768px) {
.hover-box {
width: 80px;
height: 120px;
}
.hover-box:hover {
width: 140px;
}
.stat-box-hover {
left: 140px; /* Adjust the left position for smaller screens */
font-size: 14px; /* Smaller font size for better fit */
}
}
@media (max-width: 480px) {
.hover-box {
width: 60px;
height: 90px;
}
.hover-box:hover {
width: 120px;
}
.stat-box-hover {
left: 120px; /* Adjust the left position for very small screens */
font-size: 12px; /* Smaller font size for very small screens */
padding: 8px; /* Adjust padding for small screens */
}
}
.stat-box-table {
width: 100%;
border-collapse: separate;
}
.stat-box-table th,
.stat-box-table td {
padding: 5px;
text-align: center;
background-color: rgba(0, 0, 0, 0.08); /* Semi-transparent background */
border: 1px solid #ccc;
white-space: nowrap; /* Prevent text wrapping */
overflow: hidden; /* Hide overflow */
text-overflow: ellipsis; /* Show ellipsis if content overflows */
position: relative; /* Ensure position is relative for blending */
}
.stat-box-table td::before,
.stat-box-table th::before {
content: ''; /* Empty content for overlay */
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.08); /* Darker translucent background */
mix-blend-mode: multiply; /* Blend the overlay with text */
z-index: 1; /* Ensure overlay is in front of text */
}
.stat-box-table td,
.stat-box-table th {
position: relative; /* Ensure text stays below the overlay */
z-index: 0; /* Text stays behind the overlay */
}
.stat-box-table th:first-child,
.stat-box-table td:first-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
.stat-box-table th:last-child,
.stat-box-table td:last-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
.stat-box-table .darker {
background-color: rgba(0, 0, 0, 0.25); /* Slightly darker background */
}