• Tidak ada hasil yang ditemukan

THIẾT KẾ GIAO DIỆN VỚI CSS

<li><a href="#">Máy tính Dell</a></li>

</ul>

</body>

</html>

Sử dụng thẻ ul, li hiển thị theo dạng menu ngang ( sử dụng display hiển thị theo dạng inline)

Hình 5-2: hiển thị theo dạng inline CODE THAM KHẢO

Ở thẻ li thay đổi thuộc tính display sang inline li{

color:#000000;

border:ridge #FF0000 2px;

background-color:#33FF00;

list-style-position:inside;

padding-left:15px;

width:20%;

}

Bài 2: Sử dụng CSS xây dựng giao diện theo yêu cầu (sử dụng thẻ div thiết kế giao diện)

Hình 5-3: Bố cục website Hướng dẫn:

- Bố cục trang web bao gồm đương viền bao bên ngoài website - Header, menu top, menu left, menu right, footer

- Giữa các ô các khoãng cách 5px - Header, Footer có nền màu xanh.

- Sử dụng các thuộc tính margin, padding, float, clear để thiết kế giao diện và canh chỉnh ccs thẻ nằm đúng vị trí.

- Thiết lặp text left menu và right menu cách lề trái 10px

Do the div là thẻ dạng block nên mặc định các thẻ nằm xếp chồng lên nhau, muốn tiến hành thiết lặp các thẻ div nằm theo giao diện yêu cầu phải sử dụng thẻ float để thiết lặp vị trí mong muốn (tham khảo Bài 6 , mục V phần Classification thuộc tính float).

Hình 5-4: Giao diện sử dụng các thẻ div thiết kế CODE THAM KHẢO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Untitled Document</title>

</head>

<body>

<div>

<div>Header</div>

<div>Menu</div>

<div>

<div>left</div>

<div>content</div>

<div>right</div>

</div>

<div>Footer</div>

</div>

</body>

</html>

Sau khi thiết lặp CSS cho thẻ

Hình 5-5: Sử dụng css thiết kế bố cục website CODE THAM KHẢO

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Untitled Document</title>

<style>

body{

margin-top: 0px;

margin-left: 0px;

margin-right: 0px;

} ul,li{

margin: 0px, 0px;

padding: 0px 0px;

}

#topmenu{}

#topmenu ul {

margin-top: 0px;

width: 100%;

list-style:cjk-ideographic;

}

#topmenu li {

list-style-position:inside;

border: solid 1px #EC797B;

display: inline;

margin-right: 15px;

}

#topmenu li:first-child {

margin-left: 15px;

} .menu{

background-color: #F3E6E7;

} .menu ul {

margin-top: 0px;

width: 100%;

list-style:cjk-ideographic;

} .menu li {

list-style-position:inside;

border: solid 1px #EC797B;

}

</style>

</head>

<body>

<div style="width:90%; border: solid 10px #0CF459; margin: 0px auto">

<div style="margin: 5px 5px; border: #0DF367 solid 2px; height: 150px; position: relative">

<img src="img/logosgu.jpg" width="150" height="150" style="margin-left: 50px">

<p style="position: absolute; left: 250px; top: 20px" >PHÁT TRIỂN ỨNG DỤNG WEB 1</p>

</div>

<div id="topmenu" style="margin: 5px 5px; border: #0DF367 solid 2px; height: 30px; ; line- height:30px">

<ul>

<li><a href="#">Trang chu</a></li>

<li><a href="#">Giới Thiệu</a></li>

<li><a href="#">Thông tin tuyển sinh</a></li>

<li><a href="#">Thông tin đào tạo</a></li>

<li><a href="#">Liên hệ</a></li>

</ul>

</div>

<div style="margin: 5px 5px; height: auto; border: #0DF367 solid 2px; height: 150px; overflow: hidden">

<div class="menu" style="width: 20%; border: solid 2px #F7081E; float: left">

<ul type="square">

<li><a href="#">Trang chu</a></li>

<li><a href="#">Giới Thiệu</a></li>

<li><a href="#">Thông tin tuyển sinh</a></li>

<li><a href="#">Thông tin đào tạo</a></li>

<li><a href="#">Liên hệ</a></li </ul>

<p>&nbsp;</p>

<p>&nbsp;</p>

</div>

<div style="width: 20%; float: left; width: 59%; padding-left: 10px">

<p>content</p>

</div>

<div style="width: 19%; border: solid 2px #F7081E; float: right">

<p>right</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

</div>

</div>

<div style="margin: 5px 5px; border: #0DF367 solid 1px; height: 150px; clear: both">

<p>Footer</p>

<p>&nbsp;</p>

</div>

</div>

</body>

</html>