Round edges table CSS3

Asked

Viewed 1,305 times

1

Good morning guys, I’m trying to round the edges of a table I’m using, but I can’t change either by the css file or by the style tag inside the element itself.

Would anyone know the problem with my code?

index.html

<!DOCTYPE html>

<head>
<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Pain Free</title>
    <meta name="description" content="Site voltado para manipular doencas de pacientes que utiizando o app do pain free">
    <meta name="Laura" content="">
    <link rel="stylesheet" href="./css/listar_pacientes.css">
    <link rel="stylesheet" href="./css/menu.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
      <link rel="stylesheet" href="css/ie.css">
    <![endif]-->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <script src="js/responsive-nav.js"></script>
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>  
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.quicksearch/2.3.1/jquery.quicksearch.js"></script>    
</head>

<body>

   <?php include ("class/menu.php"); ?>

        <section id="list_patient">
         <p> <h2 id="title_list_patient">Lista de Pacientes 

            <div class="form-group input-group" style="width:8em;float:right;">
              <input name="consulta" id="txt_consulta" placeholder="Pesquisar" type="text" class="form-control">
             <!-- <span class="input-group-addon"><i class='fas fa-search'></i></span>  -->
            </div>
            </h2></p>

          <div id="border-table">
                 **<table style="-moz-border-radius: 20px;" class="table table-hover" id="tabela">**
                    <thead>
                      <tr>
                        <th scope="col">Nome</th>
                        <th scope="col">Último Acesso</th>
                        <th scope="col"colspan="3">Ações</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td>Maria</td>
                        <td>12/04/2019</td>
                        <td> <a href="viewPatient.php" id="viewPatient"> <img id="viewPatientIcon" src="https://freeiconshop.com/wp-content/uploads/edd/eye-outline.png" alt="eye icon" width="30" height="30"/> </a> </td>          
                        <td> <a href="editPatient.php?codigo=<?php echo $dado["id"] ?>" id="editPatient"> <img id="editPatientIcon" src="https://cdn4.iconfinder.com/data/icons/software-menu-icons/256/SoftwareIcons-68-512.png" alt="pen icon" width="30" height="30"/> </a> </td>
                        <td> <a href="javascript: if(confirm('Tem certeza que deseja deletar o paciente <?php echo $dado["patient_name"]; ?>?'))
                         location.href='deletar.php?codigo=<?php echo $dado["id"] ?>'" id="deletePatient"> <img id="deletePatientIcon" src="https://cdn1.iconfinder.com/data/icons/basic-ui-elements-coloricon/21/19-512.png" alt="delete icon" width="30" height="30"/> </a></td>
                        </tr>
                      <?php }?>
                    </tbody>
                  </table>
            </div>
          </section>


<script src="js/fastclick.js"></script>
<script src="js/scroll.js"></script>
<script src="js/fixed-responsive-nav.js"></script>
<script>
  $('input#txt_consulta').quicksearch('table#tabela tbody tr');
</script>

</body>
</html>

listing patients.css

@-webkit-viewport { width: device-width; }
@-moz-viewport { width: device-width; }
@-ms-viewport { width: device-width; }
@-o-viewport { width: device-width; }
@viewport { width: device-width; }

body
{
    margin: 0px;
    text-align: center;
}

/* ==================== LISTA DE PACIENTES ============================ */
#list_patient
{
    width: 45em;
    margin: 0 auto;
}

#border-table
{
    border-radius: 10px;
}

.table
{
   /* padding-right: 5em; */
    font-weight: bold;
    border-radius: 10px;
}

.table tr td
{
    margin-left: 3em;
    background-color: #f5f5f5;
    text-align: center;
}

#title_list_patient
{
    margin-right: 1em;
    color: #346789;
}

1 answer

0


Table edges do not accept border-radius, but the background accepts. So, you can round the bottom edges of the table, as tds have a background color. Just put the properties that change the edge of the first and last in your CSS td of the last row of the table, which would be:

.table tr:last-child td:last-child{
    border-bottom-right-radius: 20px;
}

.table tr:last-child td:first-child{
    border-bottom-left-radius: 20px;
}

Behold:

@-webkit-viewport { width: device-width; }
@-moz-viewport { width: device-width; }
@-ms-viewport { width: device-width; }
@-o-viewport { width: device-width; }
@viewport { width: device-width; }

body
{
    margin: 0px;
    text-align: center;
}

/* ==================== LISTA DE PACIENTES ============================ */
#list_patient
{
    width: 45em;
    margin: 0 auto;
}

#border-table
{
    border-radius: 10px;
}

.table
{
   /* padding-right: 5em; */
    font-weight: bold;
    border-radius: 10px;
}

.table tr:last-child td:last-child{
    border-bottom-right-radius: 20px;
}

.table tr:last-child td:first-child{
    border-bottom-left-radius: 20px;
}

.table tr td
{
    margin-left: 3em;
    background-color: #f5f5f5;
    text-align: center;
}

#title_list_patient
{
    margin-right: 1em;
    color: #346789;
}
<section id="list_patient">
<p> <h2 id="title_list_patient">Lista de Pacientes 

   <div class="form-group input-group" style="width:8em;float:right;">
     <input name="consulta" id="txt_consulta" placeholder="Pesquisar" type="text" class="form-control">
    <!-- <span class="input-group-addon"><i class='fas fa-search'></i></span>  -->
   </div>
   </h2></p>

 <div id="border-table">
        <table style="border-radius: 20px;" class="table table-hover" id="tabela">
           <thead>
             <tr>
               <th scope="col">Nome</th>
               <th scope="col">Último Acesso</th>
               <th scope="col"colspan="3">Ações</th>
             </tr>
           </thead>
           <tbody>
             <tr>
               <td>Maria</td>
               <td>12/04/2019</td>
               <td> <a href="viewPatient.php" id="viewPatient"> <img id="viewPatientIcon" src="https://freeiconshop.com/wp-content/uploads/edd/eye-outline.png" alt="eye icon" width="30" height="30"/> </a> </td>          
               <td> <a href="editPatient.php?codigo=<?php echo $dado["id"] ?>" id="editPatient"> <img id="editPatientIcon" src="https://cdn4.iconfinder.com/data/icons/software-menu-icons/256/SoftwareIcons-68-512.png" alt="pen icon" width="30" height="30"/> </a> </td>
               <td> <a href="javascript: if(confirm('Tem certeza que deseja deletar o paciente <?php echo $dado["patient_name"]; ?>?'))
                location.href='deletar.php?codigo=<?php echo $dado["id"] ?>'" id="deletePatient"> <img id="deletePatientIcon" src="https://cdn1.iconfinder.com/data/icons/basic-ui-elements-coloricon/21/19-512.png" alt="delete icon" width="30" height="30"/> </a></td>
               </tr>
             <tr>
               <td>Maria</td>
               <td>12/04/2019</td>
               <td> <a href="viewPatient.php" id="viewPatient"> <img id="viewPatientIcon" src="https://freeiconshop.com/wp-content/uploads/edd/eye-outline.png" alt="eye icon" width="30" height="30"/> </a> </td>          
               <td> <a href="editPatient.php?codigo=<?php echo $dado["id"] ?>" id="editPatient"> <img id="editPatientIcon" src="https://cdn4.iconfinder.com/data/icons/software-menu-icons/256/SoftwareIcons-68-512.png" alt="pen icon" width="30" height="30"/> </a> </td>
               <td> <a href="javascript: if(confirm('Tem certeza que deseja deletar o paciente <?php echo $dado["patient_name"]; ?>?'))
                location.href='deletar.php?codigo=<?php echo $dado["id"] ?>'" id="deletePatient"> <img id="deletePatientIcon" src="https://cdn1.iconfinder.com/data/icons/basic-ui-elements-coloricon/21/19-512.png" alt="delete icon" width="30" height="30"/> </a></td>
               </tr>
           </tbody>
         </table>
   </div>
 </section>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.