Framework7 Cards

Framework7 Cards

Framework7 Cards are used to contain organized information of a single subject like a photo, link, and text.

Cards are mainly used along with List View to contain and organize your information.

There are 2 types of framework7 cards:

  1. Card HTML Layout: The basic card HTML layout uses card classes to arrange its items.
  2. List View With Cards: You can use cards as list view elements by adding cards-list class to <div class=”list-block”>.

Card HTML Layout

A basic card HTML layout:

    <div class="card">  
        <div class="card-header">Header</div>  
        <div class="card-content">  
            <div class="card-content-inner">Card content</div>  
        </div>  
        <div class="card-footer">Footer</div>  
    </div>  

Here:

<div class=”card”>: Card container

  • <div class=”card-header”>: Card header. Mostly used to display card title. Optional.
  • <div class=”card-footer”>: Card footer is used for some additional information or for custom actions/links. Optional.
  • <div class=”card-content”>: Main container for card content. Required.

<div class=”card-content-inner”>: Additional inner wrapper. Used to add additional padding to card-content. Optional.

The card HTML Layout contains several classes:

IndexClassDescription
1)cardsIt is the card container.
2)card-headerIt is the optional card header that is used to display card title.
3)card-footerIt is optional and used for specifying additional information or custom links.
4)card-contentIt is the main container for content of the card and is required.
5)card-content-innerIt is the optional additional inner wrapper that is used for additional padding to content.

Card HTML Layout Example

    <!DOCTYPE html>  
    <html class="with-statusbar-overlay">  
       <head>  
          <meta name = "viewport" content = "width = device-width, initial-scale = 1,   
             maximum-scale = 1, minimum-scale = 1, user-scalable = no, minimal-ui" />  
          <meta name = "apple-mobile-web-app-capable" content = "yes" />  
          <meta name = "apple-mobile-web-app-status-bar-style" content = "black" />  
          <title>Card HTML Layout</title>  
          <link rel = "stylesheet"   
             href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.min.css" />  
          <link rel = "stylesheet"   
             href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.colors.min.css" />  
          <link rel = "stylesheet"   
          href = "custom.css" />  
       </head>  
      
       <body>  
          <style>  
             .demo-card-header-pic .card-header {  
                height:40vw;  
                background-size:cover;  
                background-position:center;  
             }  
               
             .facebook-card .card-header {  
                display:block;padding:10px;  
             }  
               
             .facebook-card .facebook-avatar {  
                float:left;  
             }  
               
             .facebook-card .facebook-name {  
                margin-left:44px;  
                font-size:14px;  
                font-weight:500;  
             }  
               
             .facebook-card .facebook-date {  
                margin-left:44px;  
                font-size:13px;  
                color:#8e8e93;  
             }  
               
             .facebook-card .card-footer {  
                background:#fafafa;  
             }  
               
             .facebook-card .card-footer a {  
                color:#81848b;  
                font-weight:500;  
             }  
               
             .facebook-card .card-content img {  
                display:block;  
             }  
               
             .facebook-card .card-content-inner {  
                padding:15px 10px;  
             }  
          </style>  
            
          <div class = "views">  
             <div class = "view view-main">  
                <div class = "pages">  
                   <div data-page = "home" class = "page navbar-fixed">  
                     
                      <div class = "navbar">  
                         <div class = "navbar-inner">  
                            <div class = "left"> </div>  
                            <div class = "center">Card HTML Layout</div>  
                            <div class = "right"> </div>  
                         </div>  
                      </div>  
      
                      <div class = "page-content">  
                         <div class = "content-block-title">Simple Cards</div>  
                           
                         <div class = "card">  
                            <div class = "card-content">  
                               <div class = "card-content-inner">Lorem ipsum dolor sit amet,   
                                  consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et   
                                  dolore magna aliqua.</div>  
                            </div>  
                         </div>  
                           
                         <div class = "card">  
                            <div class = "card-header">Card header</div>  
                            <div class = "card-content">  
                               <div class = "card-content-inner">Lorem ipsum dolor sit amet,   
                                  consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et   
                                  dolore magna aliqua.</div>  
                            </div>  
                            <div class = "card-footer">Card Footer</div>  
                         </div>  
                           
                         <div class = "card">  
                            <div class = "card-content">  
                               <div class = "card-content-inner">Another card. Lorem ipsum dolor sit   
                                  amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore   
                                  et dolore magna aliqua. </div>  
                            </div>  
                         </div>  
                           
                         <div class = "content-block-title">Styled Cards</div>  
                           
                         <div class = "card demo-card-header-pic">  
                            <div style = "background-image:url(/framework7/images/nature.jpg)"   
                            valign = "bottom" class = "card-header color-white no-border">Beautiful Mountains</div>  
                              
                            <div class = "card-content">  
                               <div class = "card-content-inner">  
                                  <p class = "color-gray">Posted on May 20, 2015</p>  
                                  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit,   
                                  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>  
                               </div>  
                            </div>  
                              
                            <div class = "card-footer"><a href = "#"   
                            class = "link">Like</a><a href = "#" class = "link">Comment</a></div>  
                         </div>  
                           
                         <div class = "card facebook-card">  
                            <div class = "card-header">  
                               <div class = "facebook-avatar"><img src = "/framework7/images/cat.jpg"   
                               width = "34" height = "34"></div>  
                               <div class = "facebook-name">John Doe</div>  
                               <div class = "facebook-date">Monday at 2:15 PM</div>  
                            </div>  
                              
                            <div class = "card-content">  
                               <div class = "card-content-inner">  
                                  <p>What a nice view!!</p>  
                                  <img src = "/framework7/images/blue_hills1.jpg" width = "100%">  
                                  <p class = "color-gray">Likes: 112    Comments: 43</p>  
                               </div>  
                            </div>  
                              
                            <div class = "card-footer"><a href = "#"   
                            class = "link">Like</a><a href = "#" class = "link">Comment</a>  
                            <a href = "#" class = "link">Share</a></div>  
                         </div>  
                           
                         <div class = "content-block-title">Cards with List View</div>  
                           
                         <div class = "card">  
                            <div class = "card-content">  
                               <div class = "list-block">  
                                  <ul>  
                                     <li>  
                                        <a href = "#" class = "item-link item-content">  
                                           <div class = "item-media"><i  
                                           class = "icon icon-form-name"></i></div>  
                                           <div class = "item-inner">  
                                              <div class = "item-title">Link 1</div>  
                                           </div>  
                                        </a>  
                                     </li>  
                                       
                                     <li>  
                                        <a href = "#" class = "item-link item-content">  
                                           <div class = "item-media"><i class = "icon icon-form-name"></i></div>  
                                           <div class = "item-inner">  
                                              <div class = "item-title">Link 2</div>  
                                           </div>  
                                        </a>  
                                     </li>  
                                       
                                     <li>  
                                        <a href = "#" class = "item-link item-content">  
                                           <div class = "item-media"><i class = "icon icon-form-name"></i></div>  
                                           <div class = "item-inner">  
                                              <div class = "item-title">Link 3</div>  
                                           </div>  
                                        </a>  
                                     </li>  
                                       
                                     <li>  
                                        <a href = "#" class = "item-link item-content">  
                                           <div class = "item-media"><i class = "icon icon-form-name"></i></div>  
                                           <div class = "item-inner">  
                                              <div class = "item-title">Link 4</div>  
                                           </div>  
                                        </a>  
                                     </li>  
                                       
                                     <li>  
                                        <a href = "#" class = "item-link item-content">  
                                           <div class = "item-media"><i class = "icon icon-form-name"></i></div>  
                                           <div class = "item-inner">  
                                              <div class = "item-title">Link 5</div>  
                                           </div>  
                                        </a>  
                                     </li>  
                                  </ul>  
                               </div>  
                            </div>  
                         </div>  
                           
                         <div class = "card">  
                            <div class = "card-header">Tutorials:</div>  
                            <div class = "card-content">  
                               <div class = "list-block media-list">  
                                  <ul>  
                                     <li class = "item-content">  
                                        <div class = "item-media"><img src = "/framework7/images/pic.jpg"   
                                        width = "44"></div>  
                                        <div class = "item-inner">  
                                           <div class = "item-title-row">  
                                              <div class = "item-title">Java</div>  
                                           </div>  
                                           <div class = "item-subtitle">Sonoo</div>  
                                        </div>  
                                     </li>  
                                       
                                     <li class = "item-content">  
                                        <div class = "item-media"><img src = "/framework7/images/pic3.jpg"   
                                        width = "44"></div>  
                                        <div class = "item-inner">  
                                           <div class = "item-title-row">  
                                              <div class = "item-title">Oracle</div>  
                                           </div>  
                                           <div class = "item-subtitle">Ajeet</div>  
                                        </div>  
                                     </li>  
                                       
                                     <li class = "item-content">  
                                        <div class = "item-media"><img src = "/framework7/images/pic2.jpg"   
                                        width = "44"></div>  
                                        <div class = "item-inner">  
                                           <div class = "item-title-row">  
                                              <div class = "item-title">Go</div>  
                                           </div>  
                                           <div class = "item-subtitle">Nippun Kumar</div>  
                                        </div>  
                                     </li>  
                                  </ul>  
                               </div>  
                            </div>  
                              
                            <div class = "card-footer"> <span>May 1, 2016</span><span>45   
                            comments</span></div>  
                         </div>  
                           
                      </div>  
                   </div>  
                </div>  
             </div>  
          </div>  
            
          <script type = "text/javascript"   
             src = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/js/framework7.min.js"></script>  
               
          <script>var myApp = new Framework7();</script>  
       </body>  
    </html>  

List View with Cards

You can use cards as list view elements by adding cards-list class to <div class = “list-block”>.

Example

    <!DOCTYPE html>  
    <html class = "with-statusbar-overlay">  
       <head>  
          <meta name = "viewport" content = "width = device-width, initial-scale = 1,   
             maximum-scale = 1, minimum-scale = 1, user-scalable = no, minimal-ui" />  
          <meta name = "apple-mobile-web-app-capable" content = "yes" />  
          <meta name = "apple-mobile-web-app-status-bar-style" content = "black" />  
          <title>List View With Cards</title>  
          <link rel = "stylesheet"   
             href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.min.css" />  
          <link rel = "stylesheet"   
             href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.colors.min.css" />  
          <link rel = "stylesheet"   
             href = "custom.css" />  
       </head>  
    <body>  
          <body>  
             <div class = "views">  
                <div class = "view view-main">  
                   <div class = "pages">  
                      <div data-page = "home" class = "page navbar-fixed">                    
                         <div class = "navbar">  
                            <div class = "navbar-inner">  
                               <div class = "left"> </div>  
                               <div class = "center">List View With Cards</div>  
                               <div class = "right"> </div>  
                            </div>  
                         </div>                     
                         <div class = "page-content">  
                            <div class = "list-block cards-list">  
                               <ul>  
                                  <li class = "card">  
                                     <div class = "card-header">Card Header</div>  
                                     <div class = "card-content">  
                                        <div class = "card-content-inner">Content</div>  
                                     </div>  
                                     <div class = "card-footer">Card footer</div>  
                                  </li>                     
                                  <li class = "card">  
                                     <div class = "card-header">Card Header</div>  
                                     <div class = "card-content">  
                                        <div class = "card-content-inner">Content</div>  
                                     </div>  
                                     <div class = "card-footer">Card footer</div>  
                                  </li>                          
                                  <li class = "card">  
                                     <div class = "card-header">Card Header</div>  
                                     <div class = "card-content">  
                                        <div class = "card-content-inner">Content</div>  
                                     </div>  
                                     <div class = "card-footer">Card footer</div>  
                                  </li>  
                               </ul>  
                            </div>  
                         </div>                       
                      </div>  
                   </div>  
                </div>  
             </div>  
             <script type = "text/javascript"   
                src = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/js/framework7.min.js"></script>            
             <script>var myApp = new Framework7();</script>  
          </body>  
       </body>  
    </html>  

Next Topic:-Click Here

This Post Has One Comment

Leave a Reply

WC Captcha 3 + 2 =