Skip to content

Instantly share code, notes, and snippets.

@hazratbilal0079
Created September 11, 2024 12:30
Show Gist options
  • Save hazratbilal0079/e9d8e5ea83bedb572676153b7066b2b1 to your computer and use it in GitHub Desktop.
Save hazratbilal0079/e9d8e5ea83bedb572676153b7066b2b1 to your computer and use it in GitHub Desktop.
On Mouse Over Display Details Card layout in Html and CSS
.overlay-card {
position: relative;
width: 100%;
max-width: 1200px; /* Adjust as needed */
height: 420px;
margin-bottom: 20px; /* Space between cards */
border-radius: 8px;
overflow: hidden;
}
.card-image {
position: relative;
width: 100%;
height: 100%;
}
.card-image img {
width: 100%;
height: 100%;
object-fit: cover; /* Adjust the image to cover the area */
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.8); /* White background with some opacity */
color: #333;
display: flex;
flex-direction: column;
justify-content: center;
padding: 15px; /* Padding around the content */
box-sizing: border-box;
opacity: 0;
transition: opacity 0.3s ease;
z-index: 1;
}
.card-image:hover .overlay {
opacity: 1;
}
.card-content {
display: flex;
flex-direction: column;
}
.card-content h3 {
margin: 0 0 15px; /* Margin below the title */
font-size: 20px; /* Updated font size */
color: #333;
}
.field-row {
display: flex;
flex-wrap: wrap;
gap: 10px; /* Space between fields */
margin-bottom: 15px; /* Space below rows */
}
.field {
flex: 1 1 calc(33.33% - 10px); /* Three fields per row */
padding: 10px;
background: #f9f9f9;
border-radius: 4px;
border: 1px solid #ddd;
box-sizing: border-box;
}
.field p {
margin: 0;
font-size: 14px;
color: #333;
}
.buttons {
display: flex;
gap: 10px;
margin-top: 10px;
}
.buttons button {
border: none;
padding: 10px 15px;
color: #fff;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s ease;
}
.buttons .edit {
background-color: #007bff;
}
.buttons .delete {
background-color: #dc3545;
}
.buttons .publish {
background-color: #28a745;
}
@media (max-width: 768px) {
.field-row {
flex-direction: column;
}
.field {
width: 100%;
}
.buttons {
flex-direction: column;
}
}
<div class="overlay-card">
<div class="card-image">
<img src="https://vipprops.ae/wp-content/uploads/jet-form-builder/2172fde49301047270b2897085e4319d/2024/09/Ocean-terrace.jpg" alt="Ocean Terrace">
<div class="overlay">
<div class="card-content">
<h3>Hazrat Bilal Timber/Twing Mouse Over Card layout 04</h3>
<div class="field-row">
<div class="field">Field 1: Value</div>
<div class="field">Field 2: Value</div>
<div class="field">Field 3: Value</div>
</div>
<div class="field-row">
<div class="field">Field 4: Value</div>
<div class="field">Field 5: Value</div>
<div class="field">Field 6: Value</div>
</div>
<div class="field-row">
<div class="field">Field 7: Value</div>
<div class="field">Field 8: Value</div>
<div class="field">Field 9: Value</div>
</div>
<div class="field-row">
<div class="field">Field 10: Value</div>
<div class="field">Field 11: Value</div>
<div class="field">Field 12: Value</div>
</div>
<div class="field-row">
<div class="field">Field 13: Value</div>
<div class="field">Field 14: Value</div>
<div class="field">Field 15: Value</div>
</div>
<div class="buttons">
<button class="edit">Edit</button>
<button class="delete">Delete</button>
<button class="publish">Publish</button>
</div>
</div>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment