Ex No: 10 PAGINATION USING CSS
Aim: To design a webpage to show responsive pagination using css.
Algorithm
Step1: Create a folder “Ex9” to place the HTML files.
Step2: Create HTML file “index.html”.
Step3: Use CSS gradient options to show various gradients.
CSS Property Description
text-decoration specify text style
background-color Specify background color
text-align Align text in an element
border Specify border property
border-radius Specify rounded corner radius
width, height Specify width and height value
font-size Specify size of the font
Source Code

index.html


<!DOCTYPE html>
<html>
<head>
  <title>CSS Pagination with JavaScript</title>
  <style>  
    header {
      background: #333333;
      color: #fff;
      text-align: center;
      padding: 20px;
      border-radius: 10px 10px 0px 0px;
    }
    article {
      width: auto;
      border: 2px solid gray;
      padding: 10px;
      border-radius: 10px;
      margin: 5px;
    }
    footer {
      text-align: center;
      font-size: 12px;
      height: 50px;
      line-height: 50px;
    color: white;
      background: #333333;
      padding: 20px;
      border-radius: 10px;
    }
  .pag-cont {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
  }

  .content-page {
    display: none;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 10px;
  }

  .content-page.active {
    display: block;
  }

  .pagination {
    text-align: center;
    margin-top: 10px;
  }

  .pagination a {
    display: inline-block;
    padding: 5px 10px;
    margin-right: 5px;
    text-decoration: none;
    color: #000;
    border: 1px solid #ccc;
    cursor: pointer;
  }

  .pagination a.active {
    background-color: #333333;
    color: #ffffff;
  }
  
  .pagination a:hover:not(.active) {
    background-color: #dddddd;
    border-radius: 5px;
  }
  </style>
</head>
<body>
  <header>
    <h1>CSS Pagination</h1>
  </header>
  <article>
  <div class="pag-cont">
    <div class="content-page active" id="page1">
      <h2>Page 1</h2>
      <p>This is the content of Page 1.</p>
    </div>
    <div class="content-page" id="page2">
      <h2>Page 2</h2>
      <p>This is the content of Page 2.</p>
    </div>
      <div class="content-page" id="page3">
      <h2>Page 3</h2>
    <p>This is the content of Page 3.</p>
    </div>
    <div class="pagination">
      <a href="#" class="active" onclick="showPage(1)">1</a>
      <a href="#" onclick="showPage(2)">2</a>
      <a href="#" onclick="showPage(3)">3</a>
    </div>
  </div>
  </article>
  <footer>
  Developed by Dr. D. Natarajasivan
  </footer>
  <script>
  function showPage(pageNumber) 
  {
    const pages = document.querySelectorAll('.content-page');
    const links = document.querySelectorAll('.pagination a');

    pages.forEach(page => page.classList.remove('active'));
    links.forEach(link => link.classList.remove('active'));

    pages[pageNumber - 1].classList.add('active');
    links[pageNumber - 1].classList.add('active');
  }
  </script>
</body>
</html>
Result: Thus a webpage is designed to show responsive pagination using css.