0% completed
:target
pseudo-class and CSS transitions to achieve a smooth fade-in/out effect.Explanation:
Modal Overlay:
.modal
element covers the entire viewport with a semi-transparent black background.opacity: 0
and visibility: hidden
) and uses a transition on opacity
for a smooth fade effect.:target Pseudo-Class:
#modal
.:target
pseudo-class matches the element with the corresponding ID and makes it visible (opacity: 1
and visibility: visible
).Modal Content & Close Button:
.modal-content
is centered inside the modal overlay and styled with a white background, padding, and rounded corners..modal-close
) is positioned in the top-right corner of the modal content.href="#"
), causing the modal to disappear.Responsiveness:
max-width: 500px
and a flexible width (width: 100%
), ensuring a good appearance on different screen sizes.This solution meets all the challenge requirements, providing a fully functional pure CSS modal popup with smooth transitions and responsive design.
.....
.....
.....