使用div样式给块级数据定义样式

本文介绍了如何使用HTML的div元素进行块级数据样式定义,包括内联子窗口的创建、form表单中单选框和下拉框的应用,以及复选框的设置,展示了网页布局和交互的基本元素。

1、使用div样式给块级数据定义样式

<html>

<head>
<style>
.cities{
background-color:black;
color:White;
margin:20px;
padding:20px;
}
</style>
</head>
<body>
<div class="cities">
<h2>london</h2>
<p>London is the capital city of England. It is the most populous 
city in the United Kingdom, with a metropolitan area of over 13 
million inhabitants.
</p>


<p>Standing on the River Thames, London has been a major settlement 
for two millennia, its history going back to its founding by the 
Romans, who named it Londinium.
</p>

</div>
</body>

</html>

2、定义内联的子窗口

<html>
<head>
</head>
<body>
<iframe src=kove1.js name="love1">love1窗口</iframe>
<a href="http://www.baidu.com" target="love1">love1</a>
</body>

</html>

3、form表单单选框

<html>

<head>
</head>
<body>
<form >
frist name:
<input type="text" name="firstname" >
second name:
<input type="text" name="secondname" >

favorite food:
<input type="radio" name=fruit value="banana" >banana
<input type="radio" name=fruit value="apple" checked>apple
<input type="radio" name=fruit value="blueberry" >blueberry
<input type="radio" name=fruit value="orange" >orange

<!-- 要通过name属性来确认是在哪几个选项中进行单选,一定要设置name-value属性
-->
</form>
</body>

</html>

4、下拉框选项

<html>
<head>
</head>
<body>
<select name=cars>
<option value="volvo">volvo</option>
<option value="saab">saab</option>
<option value="fiat">fiat</option>
<option value="audi">audi</option>
</select>
</body>

</html>

4、复选框

<html>
<head>
</head>
<body>
<form>
<input type="checkbox" name="fruit" value="banana">i like banana
<br/>
<input type="checkbox" name="fruit" value="apple">i like apple
</form>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值