Styling Lists, Tables, and Forms

Styling Lists, Tables, and Forms

Maintaining a uniform appearance throughout a website depends on the style of lists, tables, and forms being consistent.

Code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Styling Lists, Tables, and Forms</title>
    <style>
        ul {
            list-style-type: none;
            padding: 0;
        }
        ul li {
            padding: 5px;
            border-bottom: 1px solid #ccc;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        table, th, td {
            border: 1px solid black;
        }
        th, td {
            padding: 10px;
            text-align: left;
        }
        form input, form button {
            padding: 10px;
            margin: 5px;
        }
    </style>
</head>
<body>
    <ul>
        <li>List Item 1</li>
        <li>List Item 2</li>
        <li>List Item 3</li>
    </ul>
    <table>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
        </tr>
    </table>
    <form>
        <input type="text" placeholder="Enter text...">
        <button type="submit">Submit</button>
    </form>
</body>
</html>

Explanation of code

Lists: Each li has padding and a bottom border for separation, and the ul is bullet-free.

Tables: The table has full width styling, including borders, padding, and text that is aligned to the left in each cell.

Forms: The padding and margins around inputs and buttons are always the same.

logo

CSS

Styling Lists, Tables, and Forms

Beginner 5 Hours

Styling Lists, Tables, and Forms

Maintaining a uniform appearance throughout a website depends on the style of lists, tables, and forms being consistent.

Code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Styling Lists, Tables, and Forms</title>
    <style>
        ul {
            list-style-type: none;
            padding: 0;
        }
        ul li {
            padding: 5px;
            border-bottom: 1px solid #ccc;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        table, th, td {
            border: 1px solid black;
        }
        th, td {
            padding: 10px;
            text-align: left;
        }
        form input, form button {
            padding: 10px;
            margin: 5px;
        }
    </style>
</head>
<body>
    <ul>
        <li>List Item 1</li>
        <li>List Item 2</li>
        <li>List Item 3</li>
    </ul>
    <table>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
        </tr>
    </table>
    <form>
        <input type="text" placeholder="Enter text...">
        <button type="submit">Submit</button>
    </form>
</body>
</html>

Explanation of code

Lists: Each li has padding and a bottom border for separation, and the ul is bullet-free.

Tables: The table has full width styling, including borders, padding, and text that is aligned to the left in each cell.

Forms: The padding and margins around inputs and buttons are always the same.

Similar Data Science Tutorials

Related tutotials

Frequently Asked Questions for css

line

Copyrights © 2024 letsupdateskills All rights reserved