zoukankan      html  css  js  c++  java
  • 如何使用HTML和CSS进行分页?

    <!DOCTYPE html> 
    <html> 
    
    <head> 
    <title> 
    How to make a Pagination 
    using HTML and CSS ? 
    </title> 
    </head> 
    
    <body> 
    <center> 
    
    <!-- Header and Slogan -->
    <h1>GeeksforGeeks</h1> 
    <p>A Computer Science Portal for Geeks</p> 
    </center> 
    
    <!-- contern in this Section -->
    <div class="content"> 
    <h3>Interview Experiences:</h3> 
    
    <article> 
    Share Your Questions/Experience or share 
    your "Interview Experience", please mail 
    your interview experience to 
    contribute@geeksforgeeks.org. Also, to 
    share interview questions, please add 
    questions at Contribute a Question! You 
    can also find company specific Interview 
    Questions at our PRACTICE portal ! 
    </article> 
    </div> 
    
    <!-- pagination elements -->
    <div class="pagination_section"> 
    <a href="#"><< Previous</a> 
    <a href="#" title="Algorithm">1</a> 
    <a href="#" title="DataStructure">2</a> 
    <a href="#" title="Languages">3</a> 
    <a href="#" title="Interview" class="active">4</a> 
    <a href="#" title="practice">5</a> 
    <a href="#">Next >></a> 
    </div> 
    </body> 
    
    </html> 


    设计结构:在上一节中,我们创建了将要使用CSS的基本网站的结构。
    CSS代码看起来不错的结构:

    <style>
    
    /* header styling */ 
    h1 { 
    color: green; 
    }
    
    /* pagination position styling */ 
    .pagination_section { 
    position: absolute; 
    top: 500px; 
    right: 230px; 
    }
    
    /* pagination styling */ 
    .pagination_section a { 
    color: black; 
    padding: 10px 18px; 
    text-decoration: none; 
    }
    
    /* pagination hover effect on non-active */ 
    .pagination_section a:hover:not(.active) { 
    background-color: #031F3B; 
    color: white; 
    }
    
    /* pagination hover effect on active*/ 
    a:nth-child(5) { 
    background-color: green; 
    color: white; 
    }
    
    a:nth-child(1) { 
    font-weight: bold; 
    }
    
    a:nth-child(7) { 
    font-weight: bold; 
    }
    
    .content { 
    margin: 50px; 
    padding: 15px; 
    width: 800px; 
    height: 200px; 
    border: 2px solid black; 
    } 
    </style>

    组合HTML和CSS代码:这是以上两个部分的组合的最终代码。

    <!DOCTYPE html> 
    <html> 
    <head> 
    <title> 
    How to make a Pagination 
    using HTML and CSS ? 
    </title> 
    <style>
    
    /* header styling */ 
    h1 { 
    color: green; 
    } 
    /* pagination position styling */
    
    .pagination_section { 
    position: absolute; 
    top: 500px; 
    right: 230px; 
    } 
    /* pagination styling */
    
    .pagination_section a { 
    color: black; 
    padding: 10px 18px; 
    text-decoration: none; 
    } 
    /* pagination hover effect on non-active */
    
    .pagination_section a:hover:not(.active) { 
    background-color: #031F3B; 
    color: white; 
    } 
    /* pagination hover effect on active*/
    
    a:nth-child(5) { 
    background-color: green; 
    color: white; 
    }
    
    a:nth-child(1) { 
    font-weight: bold; 
    }
    
    a:nth-child(7) { 
    font-weight: bold; 
    }
    
    .content { 
    margin: 50px; 
    padding: 15px; 
    width: 700px; 
    height: 200px; 
    border: 2px solid black; 
    } 
    </style> 
    </head>
    
    <body> 
    <center>
    
    <!-- Header and Slogan -->
    <h1>GeeksforGeeks</h1> 
    <p>A Computer Science Portal for Geeks</p> 
    </center>
    
    <!-- contern in this Section -->
    <div class="content"> 
    <h3>Interview Experiences:</h3>
    
    <article> 
    Share Your Questions/Experience or share 
    your "Interview Experience", please mail 
    your interview experience to 
    contribute@geeksforgeeks.org. Also, to 
    share interview questions, please add 
    questions at Contribute a Question! You 
    can also find company specific Interview 
    Questions at our PRACTICE portal ! 
    </article> 
    </div>
    
    <!-- pagination elements -->
    <div class="pagination_section"> 
    <a href="#"><< Previous</a> 
    <a href="#" title="Algorithm">1</a> 
    <a href="#" title="DataStructure">2</a> 
    <a href="#" title="Languages">3</a> 
    <a href="#" title="Interview" class="active">4</a> 
    <a href="#" title="practice">5</a> 
    <a href="#">Next >></a> 
    </div> 
    </body>
    
    </html>
  • 相关阅读:
    (Relax njuptoj)1009 数的计算(DP)
    Eclipse使用技巧总结(二)
    Ibatis的分页机制的缺陷
    TFT ST7735的Netduino驱动
    超级求爱程序--为我们的程序工作找乐子
    Selenium Grid跨浏览器-兼容性测试
    PHP一般情况下生成的缩略图都比较不理想
    库目录和头文件目录中生成画图函数
    根据PHP手册什么叫作变量的变量?
    数据库的最基本的逻辑结构组成架构
  • 原文地址:https://www.cnblogs.com/xiewangfei123/p/12842344.html
Copyright © 2011-2022 走看看