Create a table and put a background using CSS

-1

What I want to do is that with CSS styles I can create a table and put a background to it is the image that I left on the screen, and I do not know how to insert it if you could help me

This is the code that I have

<?php
require 'database.php';
$userId = null;
if (!empty($_GET['userId'])) {
    $userId = $_REQUEST['userId'];
}

if (null == $userId) {
    header("Location: index.php");
} else {
    $pdo = Database::connect();
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $sql = "SELECT * FROM USERS where userId = ?";
    $q = $pdo->prepare($sql);
    $q->execute(array($userId));
    $data = $q->fetch(PDO::FETCH_ASSOC);
    Database::disconnect();
}
?>

                                    

<body>
    <div class="container">
        <div class="span10 offset1">
            <div class="row">
                <h3>Read a USERS</h3>
            </div>

                <div class="form-horizontal" >
                <div class="control-group">
                    <label class="control-label">userId</label>
                    <div class="controls">
                        <label class="checkbox">
                            <?php echo $data['userId']; ?>
                        </label>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">userName</label>
                    <div class="controls">
                        <label class="checkbox">
                            <?php echo $data['userName']; ?>
                        </label>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">password</label>
                    <div class="controls">
                        <label class="checkbox">
                            <?php echo $data['password']; ?>
                        </label>
                    </div>
                </div>

                <div class="control-group">
                    <label class="control-label">firstName</label>
                    <div class="controls">
                        <label class="checkbox">
                            <?php echo $data['firstName']; ?>
                        </label>
                    </div>
                </div>


                <div class="control-group">
                    <label class="control-label">lastName</label>
                    <div class="controls">
                        <label class="checkbox">
                            <?php echo $data['lastName']; ?>
                        </label>
                    </div>
                </div>

                    <div class="form-actions">
                    <a class="btn" href="index.php">Back</a>
                </div>


            </div>
        </div>

    </div> <!-- /container -->
</body>

    
asked by Antoni Novoa 12.02.2017 в 22:17
source

1 answer

0

One possibility could be as follows.

Example:

table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td,
th {
  border: 1px solid #E6E6E6;
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {
  background-color: #E6E6E6;
}

.back-buton {
  border: 1px solid #E6E6E6;
  display: block;
  padding: 8px;
  text-align: center;
  width: 50px;
  transition: all .5s;
}

.back-buton:hover {
  background-color: black;
  color: white;
  transition: all .5s;
}
<table>
  <tr>
    <th>userId</th>
    <th>userName</th>
    <th>password</th>
    <th>firstName</th>
    <th>lastName</th>
  </tr>
  <tr>
    <td>1</td>
    <td>picard</td>
    <td>st0101</td>
    <td>Jean Luc</td>
    <td>Picard</td>
  </tr>
  <tr>
    <td>2</td>
    <td>foo</td>
    <td>xdF12$</td>
    <td>Foo</td>
    <td>Adam</td>
  </tr>
  <tr>
    <td>3</td>
    <td>smith</td>
    <td>DFG845def</td>
    <td>John</td>
    <td>Smith</td>
  </tr>
</table>
<div class="back-buton">Back
  <div>

You can find more examples here w3schools

    
answered by 12.03.2017 в 00:35