A Pen by HARUN PEHLİVAN on CodePen.
Created
May 21, 2021 22:28
-
-
Save harunpehlivan/367850cf8f08d066dea6590332f6f52e to your computer and use it in GitHub Desktop.
Pure CSS3 Modal Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <input type="checkbox" id="modal"> | |
| <label for="modal" class="example-label">HARUN PEHLİVAN </label> | |
| <label for="modal" class="modal-background"></label> | |
| <div class="modal"> | |
| <div class="modal-header"> | |
| <h3>FOUNDER CEO</h3> | |
| <label for="modal"> | |
| <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAdVBMVEUAAABNTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU0N3NIOAAAAJnRSTlMAAQIDBAUGBwgRFRYZGiEjQ3l7hYaqtLm8vsDFx87a4uvv8fP1+bbY9ZEAAAB8SURBVBhXXY5LFoJAAMOCIP4VBRXEv5j7H9HFDOizu2TRFljedgCQHeocWHVaAWStXnKyl2oVWI+kd1XLvFV1D7Ng3qrWKYMZ+MdEhk3gbhw59KvlH0eTnf2mgiRwvQ7NW6aqNmncukKhnvo/zzlQ2PR/HgsAJkncH6XwAcr0FUY5BVeFAAAAAElFTkSuQmCC" width="16" height="16" alt=""> | |
| </label> | |
| </div> | |
| <p>22/07/1984 Çorum'da Doğdum Aslen Samsun'un Havza ilçesi | |
| </p> | |
| <p> The language I started programming is PASCAL</p> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| font-family: Arial, Helvetica, sans-serif; | |
| } | |
| input[type="checkbox"] { | |
| display:none; | |
| } | |
| input[type="checkbox"]:checked ~ .modal, | |
| input[type="checkbox"]:checked ~ .modal-background { | |
| display: block; | |
| } | |
| .modal-background { | |
| width: 100%; | |
| height: 100%; | |
| background-color: rgba(0,0,0,0.5); | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| display: none; | |
| z-index: 9998; | |
| } | |
| .modal { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| right: 0; | |
| bottom: 0; | |
| margin: auto; | |
| display: none; | |
| width: 300px; | |
| height: 300px; | |
| background-color: #fff; | |
| box-sizing: border-box; | |
| z-index: 9999; | |
| } | |
| .modal > p { | |
| padding: 15px; | |
| margin: 0; | |
| } | |
| .modal-header { | |
| background-color: #f9f9f9; | |
| border-bottom: 1px solid #dddddd; | |
| box-sizing: border-box; | |
| height: 50px; | |
| } | |
| .modal-header h3 { | |
| margin: 0; | |
| box-sizing: border-box; | |
| padding-left: 15px; | |
| line-height: 50px; | |
| color: #4d4d4d; | |
| font-size: 16px; | |
| display: inline-block; | |
| } | |
| .modal-header label { | |
| box-sizing: border-box; | |
| border-left: 1px solid #dddddd; | |
| float: right; | |
| line-height: 50px; | |
| padding: 0 15px 0 15px; | |
| cursor: pointer; | |
| } | |
| .modal-header label:hover img { | |
| opacity: 0.6; | |
| } | |
| /* below is optional, it is just an example for the blue button */ | |
| .example-label { | |
| box-sizing: border-box; | |
| display: inline-block; | |
| padding: 10px; | |
| background-color: #375d91; | |
| color: #f9f9f9; | |
| font-size: 12px; | |
| font-weight: bold; | |
| cursor: pointer; | |
| } | |
| .example-label:hover { | |
| background-color: #3c669f; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment