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

              
                    <!DOCTYPE html>
    <html lang="en">
        <head>
    	<meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    	<title>Simple Product Card</title>
    	<link rel="stylesheet" type="text/css" href="assets/stylesheet/style.css">
    	<script src="https://kit.fontawesome.com/768ea81349.js"></script>
    </head>
    <body>
        <div class="card__container">
        	<div class="card__top__section">
        		<img src="https://raw.githubusercontent.com/TshepoMooka/html-css-and-js/master/shirt-product-card/assets/images/shirt.png">
        		<div class="card__top__section__icons">
        			<div>
        				<i class="far fa-heart"></i>
        			</div>
        			<div>
        				<i class="fas fa-shopping-basket"></i>
        			</div>
        			<div>
        				<i class="fas fa-share-alt"></i>
        			</div>
        		</div>
        	</div>
        	<div class="card__body__section">
        		<p>A BLUE SHIRT</p>
        		<span>A nice blue shirt for men. One size fit all.</span>
        	</div>
        	<div>
        	<div class="rating-section">
            <div class="stars-rating">
             <i class="fas fa-star rating-with-color"></i>
             <i class="fas fa-star rating-with-color"></i>
             <i class="fas fa-star rating-with-color"></i>
             <i class="fas fa-star-half-alt rating-with-color"></i>
             <i class="far fa-star rating-with-color"></i>
             <span>3.6 out of 5</span>
           </div>
           <div class="c-price">
             <span>R 720. 99</span>
           </div>
            </div>
        	</div>
        </div>
    </body>
    </html>

              
            
!

CSS

              
                  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

  *,
  *::before,
  *::after {
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  p,
  ul[class],
  ol[class],
  li,
  figure,
  figcaption,
  blockquote,
  dl,
  dd {
    margin: 0;
    padding: 0;
  }

  body {
    min-height: 100vh;
    scroll-behavior: smooth;
    text-rendering: optimizeSpeed;
    line-height: 1.5;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    color: #444;
    background-color: #f2f2f2;
  }

  img {
    width: 100%;
    position: relative;
    left: -38px;
    display: block;
    border-radius: inherit;
  }

  .card__container {
      width: 320px;
      background-color: #fff;
      -webkit-box-shadow: 0 2.5rem 2rem -2rem hsl(200 50% 20% / 40%);
              box-shadow: 0 2.5rem 2rem -2rem hsl(200 50% 20% / 40%);
      margin: 0 auto;
      border-radius: 8px;
      position: relative;
      top: 30px;
      margin-bottom: 60px;
    }

    .card__top__section {
      background: -webkit-gradient(linear, left top, right top, from(#64c1ff), to(#0064b7));
      background: -o-linear-gradient(left, #64c1ff, #0064b7);
      background: linear-gradient(to right, #64c1ff, #0064b7);
      background-repeat: no-repeat;
      background-size: cover;
      background-position: 0 0;
      height: 410px;
      width: 100%;
      padding: 10px 0px 0px 0px;
      border-top-left-radius: 8px;
      border-top-right-radius: 8px;
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
    }

    .card__top__section__icons > div {
    width: 38px;
    height: 38px;
    background-color: #fff;
    border-radius: 50%;
    z-index: 100;
    position: relative;
    left: -48px;
    margin-bottom: 10px;
    display: table;
    }

    .card__top__section__icons > div > i {
    vertical-align: middle;
    text-align: center;
    display: table-cell;
    color: #454545;
    font-size: 16px;
    }

    .card__body__section {
      text-align: center;
      padding: 8px 5px;
    }

    .card__body__section > p {
      font-weight: 700;
    }

    .rating-section {
    border-top: 1px solid #eee;
    padding: 8px 12px;
    margin-top: 5px;
    display: table;
    content: "";
    clear: both;
    width: 100%;
    }

    .rating-with-color {
    color: #ffa500;
    }

    .stars-rating{
    float: left;
    }

    .stars-rating > span {
      font-size: small;
    }

    .c-price{
    float: right;
    }

     @media screen and (max-width:       450px) {
      .card__container {
        width: 90% !important;
        position: fixed !important;
        left: 27px;
      }
    }
              
            
!

JS

              
                
              
            
!
999px

Console