Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
  
  <div class="wrapper">
      <div class="container">
       <div class="first">
           <p contenteditable="false">Lorem Ipsum</p>
           <div>
              <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTLGZGAn2k4mPDFjXWSliIgzKr9C2y6bzr2qWGibFQEFVbgh_Gh" width="51px" height="51px" alt="profile image">
              <div>
                 <p contenteditable="false">Dolor Mauris</p>
                 <p contenteditable="false">Adipicit laborum</p>
             </div>
           </div>
        </div>
         
        <div class="second">
               <div class="left">
                    <p>TITLE:</p>
                    <p>STARTS:</p>
                    <p>ENDS:</p>
                    <p>PLACE:</p>
               </div>
               <div class="right">
                    <p contenteditable="false">Lorem ipsum dolor sit amet</p>
                    <p contenteditable="false">11:00 am</p>
                    <p contenteditable="false">14:00 pm</p>
                    <p contenteditable="false">Consectetur HQ</p>
               </div>
        </div>
        <div class="third">
        <button>Edit details</button>
        </div>
      </div>
    <img src="https://cdn0.iconfinder.com/data/icons/faticons-2/23/close15-512.png"  alt="close icon">
  </div>
  <div class="show">Show</div>
    <div class="overlay"></div>
</body>
              
            
!

CSS

              
                body {
  background-color: goldenrod;
  font-family: Helvetica;
 
}
.show{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all .5s ease-out;
  background-color: white;
  width: 116px;
  height: 48px;
  box-shadow: 0 0 15px -5px rgba(0,0,0,.4);
  display: none;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 1;
}
.overlay{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: transparent;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}
.wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
/* transform-origin: top left; */
  z-index: 2;
  transition: all .3s ease-out;
}

@keyframes scale1 {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  40% {
    transform: translate(-50%, -50%) scale(1.16);
  }
  100% {
    transform: translate(-50%, -50%) scale(0);
  }
}

@keyframes scale2 {
  0% {
    transform: translate(-50%, -50%) scale(0);
  }
  60% {
    transform: translate(-50%, -50%) scale(1.16);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}
.container {
  background-color: white;
  width: 280px;
  height: 420px;
  box-shadow: 0 0 15px -5px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  position: relative;
}

.container::before {
  content: "";
  position: absolute;
  top: 5%;
  left: -3.2%;
  background-color: white;
  width: 20px;
  height: 20px;
  transform: rotateZ(45deg);
 
}

.wrapper>img {
  position: absolute;
  top: 4%;
  right: 5%;
  width: 12px;
  opacity: .36;
  cursor: pointer;
}

.first {
  width: 280px;
  height: 140px;
  border-bottom: .8px solid rgba(0,0,0,.26);
  display: flex;
  flex-direction: column;
   
}

.first>p {
  margin: 20px 25px 5px 25px;
 font-size: 1.58rem;
  font-weight: bold;
   
}
.first>div {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
  height: 84px;
  margin-top: 0px;
  margin-bottom: 5px;
  margin-right: 34px;
}

.first>div>div {
  display: flex;
  height: 80px;
  flex-direction: column;
/* border: 1px solid red; */
  justify-content: center;
  align-items: flex-start;
  margin-right: 20px; 
}


.first>div>div p:nth-child(1) {
  font-size: 1.1rem;
  font-weight: bold;
/* border: 1px solid red; */
  margin: 2.5px 0px;
}

.first>div>div p:nth-child(2) {
  font-size: .8rem;
/* border: 1px solid red; */
  margin: 2.5px 0px;
}


.second {
  width: 280px;
  height: 180px;
  border-bottom: .8px solid rgba(0,0,0,.26);
  display: flex;
  justify-content: space-evenly;
  padding-top: 5px;

}

.second .left p {
  color: rgba(0,0,0,.5);
  font-size: .85rem;
  font-weight: bold;
  margin-left: 5px;
  margin-right: 5px;
}

.second .left p:not(:last-child) {
  padding-bottom: 10px; 
}
.second .right p {
  color: rgba(0,0,0,1);
  font-size: .85rem;
  font-weight: bold;
  margin-left: 5px;
  margin-right: 5px; 
  text-align: right;
}

.second .right p:not(:last-child) {
  padding-bottom: 10px; 
}

.third {
  width: 280px;
  height: 120px;
 display: flex;
  justify-content: center;
  align-items: center;
}

.third button {
  background-color: rgb(101, 84, 192);
  color: white;
  border: none;
  border-radius: 50px;
  width: 168px;
  height: 54px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.35rem;
  cursor: pointer;
  outline: none;
  transition: all .2s ease;
}

.third button:hover {
    box-shadow: 0 8px 20px 1px rgba(101, 84, 192,.4);
}

.third button:active {
    box-shadow: none;
  transform: translateY(2px);
}
              
            
!

JS

              
                const closeIcon = document.querySelector('.wrapper>img');
// console.log(closeIcon);
const wrapper = document.querySelector('.wrapper');
const showButton = document.querySelector('.show');
const editButton = document.querySelector('.third button');
const paragOne = document.querySelector('.first>p');
const paragTwo = document.querySelector('.first>div>div p:nth-child(1)');
const paragThree = document.querySelector('.first>div>div p:nth-child(2)');
const rightParags = document.querySelectorAll('.second .right p:not(:last-child)');
const rightParagsLastChild = document.querySelector('.second .right p:last-child');
const overlay = document.querySelector('.overlay');

closeIcon.addEventListener('click', closeWrapper);
showButton.addEventListener('click', openWrapper);
editButton.addEventListener('click', makeContentEditableTrue);
overlay.addEventListener('click', makeContentEditableFalse);

function closeWrapper() {
  setTimeout(() => {
     wrapper.style.opacity = "0";
     setTimeout(() => {
        wrapper.style.display = "none";
     }, 280);
    showButton.style.display = "flex";
  }, 450);

    wrapper.style.animation = "scale1 .45s ease forwards";
  
    // wrapper.style.transform = "translate(-50%, -50%) scale(0)";
}

function openWrapper() {
    
  setTimeout(() => {
    wrapper.style.animation = "scale2 .45s ease forwards";
     setTimeout(() => {
         showButton.style.display = "none";
        wrapper.style.opacity = "1";
     }, 10);
  }, 280);
  wrapper.style.display = "block";
   
  
  // wrapper.style.transform = "translate(-50%, -50%) scale(1)";
}

function makeContentEditableTrue() {
      paragOne.contentEditable = true;
      paragOne.style.outline = "1px solid rgba(0,0,0,.2)";
      paragOne.style.padding = "2px 4px 2px 4px";
      paragOne.style.marginRight = "40px"; 
  
      paragTwo.contentEditable = true;
      paragTwo.style.outline = "1px solid rgba(0,0,0,.2)";
      paragTwo.style.padding = "2px 4px 2px 4px";
  
      paragThree.contentEditable = true;
      paragThree.style.outline = "1px solid rgba(0,0,0,.2)";
      paragThree.style.padding = "2px 4px 2px 4px";
  
      rightParags.forEach(rightParag => {
        rightParag.contentEditable = true;
        rightParag.style.outline = "1px solid rgba(0,0,0,.2)";
        rightParag.style.padding = "5px 5px 5px 5px";
        rightParag.style.paddingBottom = "5px"; 
        rightParag.style.marginRight = "0px"; 
        rightParag.style.marginTop = "8px"; 
      });
  
    rightParagsLastChild.contentEditable = true;
    rightParagsLastChild.style.outline = "1px solid rgba(0,0,0,.2)";
    rightParagsLastChild.style.padding = "5px 5px 5px 5px";
    rightParagsLastChild.style.paddingBottom = "5px"; 
    rightParagsLastChild.style.marginRight = "0px";
    rightParagsLastChild.style.marginTop = "8px"; 

}

function makeContentEditableFalse() {
      paragOne.contentEditable = false;
      paragOne.style.outline = "none";
      paragOne.style.padding = "0px";
      paragOne.style.marginRight = "0px"; 
  
      paragTwo.contentEditable = false;
      paragTwo.style.outline = "none";
      paragTwo.style.padding = "0px";
  
      paragThree.contentEditable = false;
      paragThree.style.outline = "none";
      paragThree.style.padding = "0px";
  
      rightParags.forEach(rightParag => {
        rightParag.contentEditable = false;
        rightParag.style.outline = "none";
        rightParag.style.padding = "0px";
        rightParag.style.paddingBottom = "10px"; 
        rightParag.style.marginRight = "5px"; 
        rightParag.style.marginTop = "14px"; 
      });
  
      rightParagsLastChild.contentEditable = false;
      rightParagsLastChild.style.outline = "none";
      rightParagsLastChild.style.padding = "0px";
      rightParagsLastChild.style.paddingBottom = "0px"; 
      rightParagsLastChild.style.marginRight = "5px";
      rightParagsLastChild.style.marginTop = "14px"; 
}
              
            
!
999px

Console