Kamis, 07 Oktober 2021

WEB DESIGN

Casecading Style Sheet (CSS)


1. CSS SelectorCSS

a. Selector <tag>

<!doctype html>

<html>

<head>

<title>CSS tag</title>

<style>

body {

background-color: lightblue;

}


h1 {

color: white;

text-align: center;

}


p {

font-family: verdana;

font-size: 20px;

}


</style>

</head>

<body>

<h1>My First CSS Example</h1>

<p>This is a paragraph.</p>

</body>

</html>


b. Selector .class

<!doctype html>
<html>
<head>
<title>CSS class</title>
<style>
.center {
text-align: center;
color: red;
}
</style>
</head>
<body>

<h1 class="center">Red and center-aligned heading</h1>
<p class="center">Red and center-aligned paragraph.</p>
</body>
</html>



2. CSS ColorButton

<!doctype html>

<html>

<head>

<title>CSS 2</title>

<style>

.btn {

border: none;

color: white;

padding: 14px 28px;

font-size: 16px;

cursor: pointer;

}


.success {background-color: #4CAF50;} /* Green */

.success:hover {background-color: #46a049;}


.info {background-color: #2196F3;} /* Blue */

.info:hover {background: #0b7dda;}


.warning {background-color: #ff9800;} /* Orange */

.warning:hover {background: #e68a00;}


.danger {background-color: #f44336;} /* Red */

.danger:hover {background: #da190b;}


.default {background-color: #e7e7e7; color: black;} /* Gray */

.default:hover {background: #ddd;}

</style>

</head>

<body>


<h1>Alert Buttons</h1>


<button class="btn success">Success</button>

<button class="btn info">Info</button>

<button class="btn warning">Warning</button>

<button class="btn danger">Danger</button>

<button class="btn default">Default</button>


</body>

</html>



3. CSS FORMS

<!doctype html>

<html>

<title>CSS 3</title>

<style>

Input{type=text}, select {

width: 100%;

padding: 12px 20px;

margin: 8px 0;

display: inline-block;

border: 1px solid #ccc;

border-radius: 4px;

box-sizing: border-box;

}


input[type=submit] {

width: 100%;

background-color: #4CAF50;

color: white;

padding: 14px 20px;

margin: 8px 0;

border: none;

border-radius: 4px

cursor: pointer;

}


input[type=submit]:hover {

background-color: #45a049;

}


div {

border-radius: 5px;

background-color: #f2f2f2;

padding: 20px;

}

</style>

<body>

<h3>Using CSS to style an HTML Form</h3>

<div>

 <form action="/action_page.php">

<label for="fname">First Name</label>

<input type="text" id="fname" name="firstname" placeholder="Your name..">

 

<label for="1name">Last Name</label>

<input type="text" id="1name" name="lastname" placeholder="Your last name..">

 

<label for="country">Country</label>

<select id="country" name="country">

<option value="australia">Australia</option>

<option value="canada">Canada</option>

<option value="usa">USA</option>

</select>

 

<input type="submit" value="Submit">

</form>

</div>

</body>

</html>



4. CSS NAVIGATION BAR

<!DOCTYPE html>

<html>

<head>

      <title>CSS 5</title>

</head>

<style>

body{ font-family:arial; }

ul {

            list-style-type: none;

            margin: 0;

            padding: 0;

            overflow: hidden;

            background-color: #333;

}

           

li {

            float: left;

}

 

li a{

            display: block;

            color: white;

            text-align: center;

            padding: 14px 16px;

            text-decoration: none;

}

 

li a:hover:not(.active) {

            background-color: #111;

}

 

.active{

            background-color: #4CAF50;

}

</style>

<body>

 

<ul>

            <li><a href="#home">Home</a></li>

            <li><a href="#news">News</a></li>

            <li><a href="#contact">Contact</a></li>

            <li style="float: right;"><a class="active" href="#about">About</a></li>

</ul>

 

</body>

</html>



5. CSS MENU DROPDOWN

<!DOCTYPE html>

<html>

<head>

<title>CSS 6</title>

<style>

body { font-family: arial; }

ul{

            list-style-type: none;

            margin: 0;

            padding: 0;

            overflow: hidden;

            background-color: #333;

}

 

li{

            float: left;

}

 

li a, .dropbtn {

            display: inline-block;

            color: white;

            text-align: center;

            padding: 14px 16px;

            text-decoration: none;

}

           

li a:hover, .dropdown:hover .dropbtn {

            background-color: red;

}

 

li, dropdown {

            display: inline-block;

}

 

.dropdown-content{

            display: none;

            position: absolute;

            background-color: #f9f9f9;

            min-width: 160px;

            box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);

            z-index: 1;

}

 

.dropdown-content a{

            color: black;

            padding: 12px 16px;

            text-decoration: none;

            display: block;

            text-align: left;

}

 

.dropdown-content a:hover {background-color: #f1f1f1}

 

.dropdown:hover .dropdown-content{

            display: block;

}

</style>

</head>

<body>

 

<ul>

            <li><a href="#home">Home</a></li>

            <li><a href="#news">News</a></li>

            <li class="dropdown">

                        <a href="javascript:void(0)" class="dropbtn">Dropdown</a>

                        <div class="dropdown-content">

                                    <a href="#">Link 1</a>

                                    <a href="#">Link 2</a>

                                    <a href="#">Link 3</a>

                        </div>

            </li>

</ul>

 

<h3>Dropdown Menu inside a Navigation Bar</h3>

<p>Hover over the "Dropdown" link to see the dropdown menu.</p>

</body>

</html>



Tidak ada komentar:

Posting Komentar

IMPLEMENTASI ALGORITMA BRANCH & BOUND

IMPLEMENTASI ALGORITMA BRANCH & BOUND           Sebagaimana pada algortima runut-balik, algoritma Branch & Bound juga merupakan meto...