HTML/CSS Styleguide

Guides for recurring elements

This guideline should be used for all the following components. A components is normally composed of an html element and css styling.


Button styles

The following button styles should be adhered to


Standard buttons

Use this button in all cases, except for when the special buttons should be used. The button text exemplifies typiccal usage of a standard button. Width follows text-width, If needs to fix width, align with positive buttons width.



Functional buttons

Use this button for specific actions, e.g. download or print out. These buttons should have a pertinent icon.



Positive buttons

Use this buttons for postive choices, such as the following examples.



Negative buttons

Use this buttons for negative choices, such as the following examples.



For hovering: decrease opacity to 0.5; decrease border-width with 1px; see example on negative buttons



                    <button class="standard-btn">Previous</button>
                    <button class="functional-btn">
                        <i class="fa-solid fa-download"></i> Download</button>
                    <button class="positive-btn">OK</button>
                    <button class="negative-btn">Cancel</button>        
                
                    .standard-btn {
                        background-color: rgb(194, 194, 194);
                        border: 2px solid rgb(50, 50, 50);
                        border-radius: 5px;
                        cursor: pointer;
                        font-family: Helvetica, sans-serif;
                        color: rgb(50, 50, 50);
                        font-size: 12px;
                        font-weight: 600;
                        margin: 5px;
                        padding: 7px 7px;
                        text-align: center;
                        display: inline-block;
                    }
                    .functional-btn {
                        background-color: rgb(135, 149, 249);
                        border: 4px solid rgb(50, 50, 50);
                        border-radius: 5px;
                        cursor: pointer;
                        font-family: Poppins, sans-serif;
                        color: rgb(50, 50, 50);
                        font-size: 12px;
                        font-weight: 600;
                        margin: 5px;
                        padding: 7px 7px;
                        width: 120px;
                        text-align: center;
                        display: inline-block;
                    }
                    .negative-btn {
                        background-color: rgb(249, 114, 114);
                        border: 2px solid rgb(50, 50, 50);
                        border-radius: 5px;
                        cursor: pointer;
                        font-family: Helvetica, sans-serif;
                        color: rgb(50, 50, 50);
                        font-size: 12px;
                        font-weight: 600;
                        margin: 5px;
                        padding: 7px 7px;
                        width: 80px;
                        text-align: center;
                        display: inline-block;
                    }
                    .positive-btn {
                        background-color: rgb(208, 249, 224);
                        border: 2px solid rgb(50, 50, 50);
                        border-radius: 5px;
                        cursor: pointer;
                        font-family: Helvetica, sans-serif;
                        color: rgb(50, 50, 50);
                        font-size: 12px;
                        font-weight: 600;
                        margin: 5px;
                        padding: 7px 7px;
                        width: 80px;
                        text-align: center;
                        display: inline-block;
                    }
                    .negative-btn:hover {
                        opacity: 0.5;
                        border: 1px solid rgb(50, 50, 50);
                    }
                


Tables

Select the appropriate table depending on the number of columns needed. Always follow these general table rules


Table with multiple columns

When table rows/objects have several or many columns/values, use this broader table. Additional columns can be added with additional html th-elements (table headers).

ID First Name Last Name SSN Age Email
1 Donald Trump 123456789 78 dt@gmail.com
2 Joe Biden 987654321 80 jb@gmail.com
3 Michael Jackson 789123456 64 mj@gmail.com

                    <table class="multiple-col-table">
                        <tr>
                            <th>ID</th>
                            <th>First Name</th>
                            <th>Last Name</th>
                            <th>SSN</th>
                            <th class="right-aligned-cell">Age</th>
                            <th>Email</th>
                        </tr>
                        <tr>
                            <td>1</td>
                            <td>Donald</td>
                            <td>Trump</td>
                            <td>123456789</td>
                            <td class="right-aligned-cell">78</td>
                            <td>dt@gmail.com</td>
                        </tr>
                        <tr>
                            <td>2</td>
                            <td>Joe</td>
                            <td>Biden</td>
                            <td>987654321</td>
                            <td class="right-aligned-cell">80</td>
                            <td>jb@gmail.com</td>
                        </tr>
                        <tr>
                            <td>3</td>
                            <td>Michael</td>
                            <td>Jackson</td>
                            <td>789123456</td>
                            <td class="right-aligned-cell">64</td>
                            <td>mj@gmail.com</td>
                        </tr>
                    </table>
                
                    .multiple-col-table {
                        width: 700px;
                        border: 1px solid rgb(50, 50, 50);
                        border-collapse: collapse;
                    }
                    th, td {
                        padding: 8px;
                        border: 1px solid rgb(50, 50, 50);
                    }
                    .multiple-col-table tr:nth-child(even) {
                        background-color: #D6EEEE;
                    }
                    .right-aligned-cell {
                        text-align: right;
                    }
                


Table with few columns

When table columns/values are few, less than or equal to 3, use this longer table. Such tables usually have many rows/objects, and corresponds to a list.

City Tourists/year
Cairo 5 761 000
London 9 857 000
New York 12 550 000
Dubai 14 290 000
Beijing 19 270 000


Information

This section deals with messages, warnings & panels for information. The overall rules for informing the users or stakeholders that uses our systems and websites:


Messages

Confirmation message and neutral information are information on actions and changes with no noteworthy negative consequences. Examples are a successful download confirmation or neutral information on number of minutes left.


× Success: regards a successful positive action
× Info: regards a neutral action or change


Warnings

If a message is to warn the user, use these information style depending on the seriosity of the matter.


× Warning: informs on a risk with negative effects
× Danger: regards a potentially dangerous and risky action

Click on the x-button to close down the messages above. If they are already closed and gone, refresh page by clicking here.


                    <div class="alert success">
                        <span class="closing-x">×</span>
                        <strong>Success:</strong> 
                        regards a successful positive action
                    </div>
                    <div class="alert neutral">
                        <span class="closing-x">×</span>
                        <strong>Info:</strong> 
                        regards a neutral action or change
                    </div>
                    <div class="alert warning">
                        <span class="closing-x">×</span>
                        <strong>Warning:</strong> 
                        informs on a risk with negative effects
                    </div>
                    <div class="alert danger">
                        <span class="closing-x">×</span>
                        <strong>Danger:</strong> 
                        regards a potentially dangerous and risky action
                    </div>
                
                    .alert {
                        padding: 25px;
                        color: white;
                        opacity: 1;
                        transition: opacity 0.6s;
                        margin-bottom: 15px;
                    }
                    .closing-x {
                        color: white;
                        font-weight: 900;
                        float: right;
                        font-size: 32px;
                        line-height: 16px;
                        cursor: pointer;
                    }
                    .closing-x:hover {
                        color: rgb(16, 16, 16);
                    }
                    .alert.success {
                        background-color: rgb(14, 191, 126);
                    }
                    .alert.neutral {
                        background-color: rgb(108, 110, 251);
                    }
                    .alert.warning {
                        background-color: rgb(255, 156, 7);
                    }
                    .alert.danger {
                        background-color: rgb(241, 76, 76);
                    } 
                


Panels

Panels are information of more general or optional nature, that can contain positive, neutral or negative information content. Select appropriate panel/banner and its aligned button.


×

I am a sidepanel to inform about positive matters

×

I am a sidepanel to inform about neutral matters

×

I am a sidepanel to inform about negative matters



Click on any buttons to see its panel type (then click x to close the panel)


                <button id="positive-panel-btn" 
                    class="open-panel-btn positive-btn">
                    Open positive sidepanel</button>
                <button id="neutral-panel-btn" 
                    class="open-panel-btn standard-btn">
                    Open neutral sidepanel</button>
                <button id="negative-panel-btn" 
                    class="open-panel-btn negative-btn">
                    Open negative sidepanel</button>
    
                <div id="positive-panel" 
                    class="sidepanel large-text semibold-weight">
                    <span class="closing-panel-x">×</span>
                    <p>I am a sidepanel to inform about positive matters</p>
                </div>
                <div id="neutral-panel" 
                    class="sidepanel large-text semibold-weight">
                    <span class="closing-panel-x">×</span>
                    <p>I am a sidepanel to inform about neutral matters</p>
                </div>
                <div id="negative-panel"
                     class="sidepanel large-text semibold-weight">
                    <span class="closing-panel-x">×</span>
                    <p>I am a sidepanel to inform about negative matters</p>
                </div>    
                
                        .sidepanel {
                            height: 0;
                            width: 0;
                            position: fixed;
                            z-index: 1;
                            bottom: 0;
                            right: 0;
                            overflow-x: hidden;
                            transition: 0.5s;
                            text-align: center;
                        }
                        #positive-panel {
                            background-color: rgb(208, 249, 224);
                        }
                        #neutral-panel {
                            background-color: rgb(194, 194, 194);
                        }
                        #negative-panel {
                            background-color: rgb(249, 114, 114);
                        }
                        .closing-panel-x {
                            color: white;
                            font-weight: 900;
                            float: right;
                            font-size: 48px;
                            line-height: 24px;
                            cursor: pointer;
                        }
                    

Loader

The following loader is our standard loadspinner.


Lo ad ing


                <div class="loadspinner load-group"></div>
                <span class="load-span load-group small-text semibold-weight">
                    <span class="blinking-dot">Lo</span>
                    <span class="blinking-dot">ad</span>
                    <span class="blinking-dot">ing</span>
                </span>
                
                    .load-group {
                        display: inline-block;
                    }
                    .loadspinner {
                        width: 20px;
                        height: 20px;
                        border: 10px dashed rgb(255, 255, 255);
                        border-top: 10px solid rgb(76, 64, 248);
                        border-radius: 50%;
                        animation: spin 3s linear infinite;
                    }
                    @keyframes spin {
                        0% {
                            transform: rotate(0deg);
                        }
                        100% {
                            transform: rotate(360deg);
                        }
                    }
                    .load-span {
                        margin-left: 5px;
                    }
                    .blinking-dot {
                        animation: 1s blinking infinite;
                        margin-left: -4px;
                    }
                    .blinking-dot:nth-child(2) {
                        animation-delay: 250ms;
                    }
                    .blinking-dot:nth-child(3) {
                        animation-delay: 500ms;
                    }
                    @keyframes blinking {
                        75% {
                            color: rgb(76, 64, 248);
                        }
                    }
                

Forms

Forms for inputs and selections should follow this section. General form rules:

Coloring form labels are allowed, but should be aligned with table colors (see Tables sections)


Registration form example














                <form id="submit-form">
                    <label for="fname" class="small-text semibold-weight">
                        First name:</label><br>
                    <input type="text" id="fname" name="fname"><br>
                    <label for="lname" class="small-text semibold-weight">
                        Last name:</label><br>
                    <input type="text" id="ename" name="lname"><br>
                    <label for="email" class="small-text semibold-weight">
                        Email:</label><br>
                    <input type="text" id="email" name="email"><br>
                    <label for="birthday" class="small-text semibold-weight">
                        Birthday:</label><br>
                    <input id="birthday" type="date" name="birthday"><br>
                    <label for="language" class="small-text semibold-weight">
                        Language:</label><br>
                    <select id="language" name="language" class="small-text">
                        <option value="arabic" selected>Arabic</option>
                        <option value="Chinese">Chinese</option>
                        <option value="English">English</option>
                        <option value="Swedish">Swedish</option>
                    </select><br>
                    <input type="checkbox" id="student" name="student">
                    <label for="return" id="student-question" 
                        class="small-text semibold-weight">
                        Student?</label><br>
                    <input type="submit" value="Submit" id="submit-btn">
                </form>
                
                    label, input, select {
                        font-family: Helvetica, sans-serif;
                        margin: 5px 0;
                    }
                    label {
                        color: rgb(50, 50, 50);
                    }
                    input {
                        color: rgb(50, 50, 50);
                        width: 700px;
                    }
                    select {
                        color: rgb(50, 50, 50);
                        margin-top: 0;
                        margin-bottom: 2px;
                        color: black;
                        width: 350px;
                        padding: 2px;
                    }
                    #student, #student-question {
                        color: rgb(50, 50, 50);
                        margin: 10px 5px;
                        width: auto;
                        float: left;
                    }
                    #submit-btn {
                        background-color: rgb(135, 149, 249);
                        font-weight: 600;
                        padding: 7px 35px;
                        border: 3px solid rgb(18, 18, 18);
                    }