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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <main id = "main">
  <header id = "title">
    <h1>Mahendra Singh Dhoni</h1>
   </header>
    <p class = "sub-text">The cricketer who made the dreams of a billion people a reality</p>
  <figure id = "img-div">
    <img src = "https://s.ndtvimg.com/images/content/2014/dec/806/ms-dhoni-with-world-cup.jpg" alt = "Picture of Dhoni" id = "image">
    <figcaption id = "img-caption">Dhoni with 2011 WC Trophy</figcaption>
    </figure>
    <article id = "tribute-info">
      <h2>Timeline of Dhoni's Career</h2>
      <ul>
        <li><span class = "date">December 2004: </span>Dhoni makes his international debut against Bangladesh in an ODI at Chittagong.</li>
        <li><span class = "date">October 2005: </span>Scored 183 against Sri Lanka, highest individual score for a wicket-keeper.</li>
        <li><span class = "date">December 2005: </span> Dhoni makes his Test debut against Sri Lanka in Chennai.</li>
        <li><span class = "date">September 2007: </span> Dhoni takes over the reins of ODI captaincy from Rahul Dravid.</li>
        <li><span class = "date">September 2007: </span>Beats Pakistan in the final of the inaugral ICC World T20.</li>
        <li><span class = "date">August 2008:</span> Dhoni wins the Rajiv Gandhi Khel Ratna award.</li>
        <li><span class = "date">November 2008:</span>Dhoni makes his debut as full-time Test captain of India during the fourth and final Test against Australia at Nagpur.</li>
        <li><span class = "date"> December 2008:</span>Dhoni wins the ICC ODI Player of the Year honour.</li>
        <li><span class = "date">March 2009: </span> Dhoni leads India to its first bilateral ODI series victory in New Zealand.</li>
        <li><span class = "date">April 2009: </span> Dhoni honoured with the Padma Shri, India's fourth highest civilian honour.</li>
        <li><span class = "date">December 2009: </span> Under Dhoni's captaincy, India tops the ICC Test cricket rankings for the first time.</li>
        <li><span class = "date">December 2009: </span>  Dhoni retains his ICC ODI Player of the year award, becomes the first player to win it twice.</li>
       <li><span class = "date">May 2010: </span>  Dhoni leads Chennai Super Kings to their maiden Indian Premier League title, beating Mumbai Indian by 22 runs in the final.</li>
        <li><span class = "date">April 2011: </span>  Dhoni scores 91<sup>*</sup> off 79 balls against Sri Lanka in the World Cup final to help India lift the trophy after 28 years.</li>
        <li><span class = "date">May 2011: </span> Chennai Super Kings retain the IPL, beat Royal Challengers Banglore by 58 runs in the final.</li>
        <li><span class = "date">November 2011: </span> The Indian Territorial Army confers the honorary rank of Lieutenant Colonel on Dhoni.</li>
        <li><span class = "date">March 2013: </span>  Dhoni becomes the most successful Indian Test captain, eclipses Sourav Ganguly's record of 21 victories from 49 Tests.</li>
        <li><span class = "date">June 2013: </span>  India win the ICC Champions Trophy by defeating England by five runs in the final. He became the first captain to win all 3 ICC trophies.</li>
        <li><span class = "date">February 2013: </span>  Dhoni powers his way to his first double hundred in Tests, scoring 224 off 365 balls against Australia.</li>
        <li><span class = "date">March 2013: </span>India beats Australia 4-0 at home for the first time in a Test series.</li>
        <li><span class = "date">March 2015: </span>Leads India to the World Cup semi-final, but fall short against Australia.</li>
        <li><span class = "date">January 2017: </span>Steps down as Indian captian and hands the reins to Virat Kohli.</li>
        <li><span class = "date">April 2018: </span> Dhoni receives the Padma Bhushan, India's third-highest civillian honour.</li>
       <li><span class = "date">May 2018: </span> Chennai Super Kings win their third IPL title by defeating Sunrisers Hyderabad by eight wickets.</li>
       <li><span class = "date">August 2020: </span> Announces retirement from all forms of cricket.</li>
      </ul>
      <blockquote>"He knows exactly what he wants to do in the middle. He is always calm and composed. He allows himself to make those tough decisions on the field. For me, he will always be my captain." – Virat Kohli</blockquote>
    </article>
    <footer>
      To learn more about this <a href = "https://en.wikipedia.org/wiki/MS_Dhoni" id = "tribute-link" target = "_blank">cricketing legend.</a>
    </footer>
</main>

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html{
  font-size: 10px;
}
body{
  min-height: 100vh;
  min-width: 100vw;
  background: #536976;  /* fallback for old browsers */
  background: linear-gradient(to right, #292E49, #536976);
  text-align: center;
  font-family: 'Roboto', sans-serif;
}
#main{
  margin:8%;
  background-color: #eee;
}
#title{
  font-size: 3rem;
  padding: 4rem;
}
.sub-text{
  font-size: 2rem;
}
#img-div{
  margin: 15px 0;
  padding: 0;
}
#image{
  max-width: 100%;
  display: block;
  margin: 0 auto;
  height: auto;
}
#img-caption{
  font-size: 1.2rem;
  margin: 10px 0;
}
h2{
  text-align: center;
  font-size: 3rem;
  margin: 2rem 0;
}
.date{
  font-weight: bold;
}
li{
  margin: 16px 0;
}
ul{
  max-width: 60%;
  padding: 0 1rem;
  margin: 0 auto 30px auto;
  font-size: 1.7rem;
  text-align: left;
  line-height: 1.5;
}
blockquote{
  max-width: 70%;
  color: gray;
  font-size: 1.6rem;
  padding: 0 1rem;
  margin: 0 auto;
  text-align: left;
}
footer{
  font-size: 2.5rem;
  padding: 3rem 2rem;
}
#tribute-link{
  color: #536976;
  text-decoration: none;
}
#tribute-link:hover{
  text-decoration: underline;
}
@media (max-width: 600px)
{
  #main{
    margin: 5%;
  }
  #title{
    font-size: 1.8rem;
    padding: 1.5rem;
  }
  .sub-text{
    font-size: 1.3rem;
  }
  #img-caption{
  font-size: 1.2rem;
  padding: 0.7rem;
}
  h2{
    font-size: 1.8rem;
  }
 ul {
  max-width: 75%;
  font-size: 1.4rem;
}
  blockquote{
  max-width: 90%;
  font-size: 1.4rem;

  font-weight: bold;
  line-height: 1.4;
  padding: 0 1rem;
  margin: 0 auto;
  text-align: left;
}
  footer{
  font-size: 2rem;
  padding: 3rem 2rem;
}
}


              
            
!

JS

              
                /*User Story #1: My tribute page should have an element with a corresponding id="main", which contains all other elements.

User Story #2: I should see an element with a corresponding id="title", which contains a string (i.e. text) that describes the subject of the tribute page (e.g. "Dr. Norman Borlaug").

User Story #3: I should see a div element with a corresponding id="img-div".

User Story #4: Within the img-div element, I should see an img element with a corresponding id="image".

User Story #5: Within the img-div element, I should see an element with a corresponding id="img-caption" that contains textual content describing the image shown in img-div.

User Story #6: I should see an element with a corresponding id="tribute-info", which contains textual content describing the subject of the tribute page.

User Story #7: I should see an a element with a corresponding id="tribute-link", which links to an outside site that contains additional information about the subject of the tribute page. HINT: You must give your element an attribute of target and set it to _blank in order for your link to open in a new tab (i.e. target="_blank").

User Story #8: The img element should responsively resize, relative to the width of its parent element, without exceeding its original size.

User Story #9: The img element should be centered within its parent element.*/

              
            
!
999px

Console