ພັນທະນາ HTML

对 HTML 进行分类(设置类),使我们能够为元素的类定义 CSS 样式。

为相同的类设置相同的样式,或者为不同的类设置不同的样式。

ຄວາມຄົນທີ່ຕັ້ງ

<!DOCTYPE html>
<html>
<head>
<style>
.cities {
    background-color:black;
    color:white;
    margin:20px;
    padding:20px;
} 
</style>
</head>
<body>
<div class="cities">
<h2>London</h2>
<p>
ລອນດອນເປັນສະຖານທີ່ເມືອງຫຼວງຂອງອັງກິດ. 
It is the most populous city in the United Kingdom, 
ພ້ອມດ້ວຍອານານິຄົມມີປະຊາກອນຫຼາຍກວ່າ 13 ລ້ານຄົນ.
</p>
</div> 
</body>
</html>

ພະຍາຍາມຕະຫລອດຄັ້ງນັ້ນ

ປະເພດສະບັບທີ່ບາງສ່ວນຄວາມໃຫຍ່

HTML <div> ສິນລະພາບປະເພດສະບັບທີ່ບາງສ່ວນ。ມັນສາມາດເປັນສະໜາມສຳລັບສິ່ງເປັນສິ່ງອື່ນໃນ HTML.

ການຈັດ <div> ສາຍຄຸນເພື່ອຈະຈັດການພິມຮູບແບບສະເພາະໃຫ້ <div> ສະເພາະດຽວກັນຈະຈັດການພິມຮູບແບບດຽວກັນ:

ຄວາມຄົນທີ່ຕັ້ງ

<!DOCTYPE html>
<html>
<head>
<style>
.cities {
    background-color:black;
    color:white;
    margin:20px;
    padding:20px;
} 
</style>
</head>
<body>
<div class="cities">
<h2>London</h2>
<p>ລອນດອນເປັນສະຖານທີ່ເມືອງຫຼວງຂອງອັງກິດ. 
It is the most populous city in the United Kingdom, 
with a metropolitan area of over 13 million inhabitants.</p>
</div>
<div class="cities">
<h2>Paris</h2>
<p>Paris is the capital and most populous city of France.</p>
</div>
<div class="cities">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan, the center of the Greater Tokyo Area,</p>
and the most populous metropolitan area in the world.</p>
</div>
</body>
</html>

ພະຍາຍາມຕະຫລອດຄັ້ງນັ້ນ

ການຈັດການສະຖານະວັດຖຸສະໜາມ

HTML <span> ສະຖານະວັດຖຸ ສະໜາມ, ສາມາດໃຊ້ເປັນສານວັດຖຸຂອງຂໍ້ຄວາມ.

ການຕັ້ງ ປະເພດ <span> ສະແນວສະໜາມໄດ້ໃຫ້ການຕັ້ງ ປະເພດ <span> ສະແນວສະໜາມດຽວກັນ.

ຄວາມຄົນທີ່ຕັ້ງ

<!DOCTYPE html>
<html>
<head>
<style>
  span.red {color:red;}
</style>
</head>
<body>
<h1>My <span class="red">Important</span> Heading</h1>
</body>
</html>

ພະຍາຍາມຕະຫລອດຄັ້ງນັ້ນ