Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

Save Automatically?

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 id="viewEvent">
  <div id="myID3" class="bg-primary">
    <h3 class="text-center"> 'DIV' and 'H3 Tag' manually added and Bootstrap Classes</h3>
  </div>
</div>
              
            
!

CSS

              
                #readMore { display: none;}/* js 'read more' script*/

  div#myID, div#myID2, div#myID3{ 
    max-width: 1200px;
    border: 5px ridge lightgrey; 
}

div#myID3 { margin: auto;}
div#myID , div#myID2, div#myID3{padding: 20px;}

/* IMAGE CSS */
div#myID img{
  max-width: 200px;
  max-height: 200px;
  border-radius: 15px;
 }
/* IMAGE MEDIA QUERIES */
@media screen and (max-width: 350px){
  div#myID img{
    max-width: 150px;
    max-height: 150px;
    }
 }
@media screen and (min-width: 600px){
  div#myID img{
    max-width: 250px;
    max-height: 250px;
    }
 }
              
            
!

JS

              
                function readMore()
    {  //get elements assign to variable
        var dotText = document.getElementById("dot");
        var readMoreText = document.getElementById("readMore");
        var btnText = document.getElementById("btn");

      if(readMoreText.style.display == "none")
      {
        dotText.style.display = "none";
        readMoreText.style.display = "inline";
        btnText.innerHTML = "read less";
      }
      else
      {
        dotText.style.display = "inline";
        readMoreText.style.display = "none";
        btnText.innerHTML = "read more";
      }
    }
    document.body.onload = addElement;

    function addElement () {
      // CREATE A NEW DIV ELEMENT
      const newDiv = document.createElement("div");
      newDiv.setAttribute("id", "myID");
      newDiv.setAttribute("class", "bg-info mx-auto text-center");
      //CREATE NEW IMG ELEMENT TO APPEND TO NEW DIV
      newContent = document.createElement("img");
      newContent.src = "https://www.eventcombo.com/Images/ECImages/46a7b124-87a6-4aaf-ae36-95572a94bbf7.jpg";
            
      //CREATE NEW DIV2 ELEMENT
      const newDiv2 = document.createElement("div");
      newDiv2.setAttribute("id", "myID2");
      newDiv2.setAttribute("class", "bg-success text-black text-uppercase font-weight-bold mx-auto text-center");
      // CREATE NEW P ELEMENT TO APPEND TO NEW DIV2
      newContent2 = document.createElement("p");
      var t = document.createTextNode("Added New Dynamic 'div', 'paragraph', 'text' and 'image' created with Javascript; ");
      var z = document.createTextNode("added new dynamic class attribute with the Bootstrap Framework");
      newDiv2.appendChild(t);
      newDiv2.appendChild(z);
      
      //CREATE NEW DIV3 ELEMENT
      const newDiv3 = document.createElement("a");
      //ATTRIBUTE FOR NEW DIV3 AND APPEND TO NewDiv
      newDiv3.setAttribute("href", "https://rockitwomen.com");
      newDiv3.setAttribute("target", "__blank");
      newDiv3.setAttribute("class", "mx-auto");
      newDiv3.appendChild(newContent);  
      newDiv.appendChild(newDiv3);
    
      // ADD NEW ELEMENTS AND CONTENT TO THE DOM
      const currentDiv = document.getElementById("viewEvent");
      document.body.insertBefore(newDiv, currentDiv);
      document.body.insertBefore(newDiv2, newDiv);
    }

              
            
!
999px

Console