.flex-container { display: flex; gap: 10px; perspective: 1000px; /* For a subtle 3D effect on hover */ padding: 20px; background-color: #f8f8f8; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); } .flex-item { flex: 1; padding: 20px; background-color: #f0f0f0; border: 1px solid #ccc; border-radius: 5px; transition: transform 0.3s ease, z-index 0.3s ease, box-shadow 0.3s ease, order 0.3s ease; position: relative; /* Needed for z-index to work against siblings */ z-index: 1; text-align: center; cursor: pointer; } .flex-item:nth-child(even) { background-color: #e0e0e0; } .flex-item:hover, .flex-item:focus-within { /* focus-within for accessibility */ order: -1; /* Move to the beginning visually */ z-index: 10; /* Bring to front */ transform: translateY(-5px) scale(1.03); /* Subtle lift effect */ box-shadow: 0 8px 15px rgba(0,0,0,0.2); } /* Example for HTML: