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

              
                <div class="right-side">
    <p>
        This is a paragraph with some
        <span id="difficult-word" popovertarget="mypopover"
            >difficult</span
        >
        words that you can hover over to see their meanings.
    </p>
    <dialog id="mypopover" popover>
  <p><strong>Difficult:</strong> Requiring effort, skill, or persistence to overcome; complex; unpleasant; stubborn.</p>
</dialog>

<div id="chat-window">
<button popovertarget="chat-popover-window" id="chat-button">
<img src="https://i.postimg.cc/jdnTBDkr/more.png" alt="Button Image" heigh=50px width=50px />
</button>
<div id="chat-popover-window" class="popover" popover>
<p>About Us</p>
  <hr/>
<p>Shop More</p>
  <hr/>
</div>
</div>

<button popovertarget="tour-dialog" id="showDialogButton">
take tour
</button>
        <dialog id="tour-dialog" popover="auto" popovertargetaction="hide">
          <div id="tour-content">
                <h2>Welcome to the Guided Tour!</h2>
                <p>
                    This tour will guide you through the basics of this
                    website.
                </p>
                <div class="buttons">
                    <button id="next-button" popovertarget="tour-content-html">Next</button>
                    <button id="cancel-button" popovertarget="tour-dialog" popovertargetaction="hide">Cancel</button>
                </div>
            </div>
        </dialog>
        <dialog id="tour-content-html" popover="auto" >
           <div class="triangle-top"></div>
            <div>
                <h2>This is where you enter HTML</h2>
                <p>This section is dedicated to entering HTML code.</p>
                <div class="buttons">
                    <button id="next-button" popovertarget="tour-content-css">Next</button>
                    <button id="cancel-button" popovertarget="tour-content-html" popovertargetaction="hide">Cancel</button>
                </div>
            </div>
        </dialog>
        <dialog id="tour-content-css" popover>
            <div class="triangle-top"></div>
            <h2>This is where you enter CSS</h2>
            <p>This section is dedicated to entering CSS code.</p>
            <div class="buttons">
                <button id="next-button" popovertarget="tour-content-js">Next</button>
                <button id="cancel-button" popovertarget="tour-content-css" popovertargetaction="hide">Cancel</button>
            </div>
        </dialog>
        <dialog id="tour-content-js" popover>
            <div class="triangle-top"></div>
            <h2>This is where you enter Javascript</h2>
            <p>This section is dedicated to entering Javascript code.</p>
            <div class="buttons">
                <button id="thankyou-button" popovertarget="tour-content-js" popovertargetaction="hide">Thank You!</button>
            </div>
        </dialog>

</div>

              
            
!

CSS

              
                #mypopover:popover-open{
     position: absolute;
    bottom: 45%;
    height: 150px;
    right: 60%;
    width: 250px;
    transform: translateX(-50%);
}

#difficult-word {
  text-decoration: underline;
  cursor: pointer;
}

#chat-window > button {
    background-color: transparent;
    border: none;
    cursor: pointer;
}

#chat-button {
  /* Styles for the button */
  position: fixed;
  top: 20px; /* Adjust this value as needed */
  right: 20px; /* Adjust this value as needed */
  cursor: pointer;
  padding: 10px;
  border-radius: 15px;
  background-color: transparent;
  /* Add more styles as needed */
}

#chat-popover-window{
  position: absolute;
  inset: unset;
  left: auto;
  right: 25px;
  position: relative;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 10px;
}

#tour-dialog {
   position: relative;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 10px;
  left: 5%;
}

.triangle-top {
  position: absolute;
  top: -15px; /* Adjust this value as needed */
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid black;
}

#tour-content-html {
  position: relative;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 10px;
  bottom: 65%;
  right: 50%;
  transform: translateX(-50%);
}

#tour-content-css {
  position: relative;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 10px;
  bottom: 65%;
  left: 25%;
  transform: translateX(-50%);
}

#tour-content-js {
  position: relative;
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 10px;
  bottom: 55%;
  left: 85%;
  transform: translateX(-50%);
}
              
            
!

JS

              
                const tooltipPopOver = document.getElementById("difficult-word");
 const target = document.getElementById("mypopover");

tooltipPopOver.addEventListener("mouseover",()=>{
    target.showPopover();
  });
  
tooltipPopOver.addEventListener("mouseout",()=>{
    target.hidePopover();
  });

document.addEventListener("click", (event) => {
  const clickedElement = event.target;

  if (clickedElement.id === "next-button") {
    const parentElement = clickedElement.closest("dialog");

    parentElement.togglePopover();
  }
});


              
            
!
999px

Console