css入门代码

该博客展示了CSS入门的外部样式表示例。包含HTML代码,通过<link>标签引入外部CSS文件,以及具体的CSS代码,对页面各元素如logo、banner、nav等的样式进行了设置,包括宽高、背景颜色等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

外部样式表

<html>
<head>
<title>css入门</title>
<link rel="stylesheet" type="text/css" href="basic.css"/>
</head>
<body>
<div id="logo">flash</div>
<div id="banner">宣传画</div>
<div id="nav">导航</div>
<div id="hot">
<h1>热点新闻</h1>
</div>
<div id="content">主要内容</div>
<div id="intro">介绍</div>
<div id="footer">版权</div>
</body>
</html>

css代码

* {
    margin:0;
    padding:0;
}
body {
    width:760px;
    margin:0 auto;
    font-size:12px;
}

ul {
    list-style-type:none;
}

#logo {
    width:760px;
    height:190px;
    background-color:red;
}

#banner {
    width:760px;
    height:40px;
    margin-bottom:10px;
    background-color:blue;
}
#nav {
    width:760px;
    height:60px;
    margin-bottom:10px;
    background:yellow;
}
#hot {
    width:250px;
    height:226px;
    margin-bottom:10px;
    background:yellow;
    float:right;
}
#intro  {
    width:250px;
    height:100px;
    margin-bottom:10px;
    background:pink;
    float:right;
}
#content {
    width:500px;
    height:336px;
    margin-bottom:10px;
    background:purple;
    float:left;
}
#footer {
    clear:both;
    width:760px;
    height:120px;
    background:rgb(255,255,0);
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值