HTML与CSS绘制简单DIV布局

HTML代码<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>极客学院</title>
    <link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
    <div class="container">
        <div class="wrapper">
            <div class="heading">
                <div class="heading_nav">
                    <div class="heading_title">
                        极客学院
                    </div>
                    <div class="heading_navbar">
                        <ul>
                            <li><a href="#">首页</a></li>
                            <li><a href="#">职业课程</a></li>
                            <li><a href="#">技术问答</a></li>
                            <li><a href="#">VIP会员</a></li>
                        </ul>
                    </div>
                    <div class="heading_img">
                        <img src="1.jpg">
                    </div>
                    <div class="heading_spotlight">
                        <form>
                            <input type="text">
                        </form>
                    </div>
                </div>
            </div>
            <div class="body">
                <div class="body_title">
                    <h3>熟悉极客学院</h3>
                    <p>加入极客学院,学习实战教程,全面提升你的学习能力</p>
                </div>
                <hr/>
                <hr/>
            </div>
        </div>
        <div class="footing">
            @极客学院
        </div>
    </div>
</body>
</html>

图片源1.jpg如下

效果如下

CSS代码*{
    margin: 0px;
    padding: 0px;
}
body{
    background-color: snow;
}
.wrapper{
    width: 80%;
    height: 1000px;
    background-color: antiquewhite;
    margin:0px auto;
}
.heading{
    width: 100%;
    height: 90px;
    background-color: snow;
    margin: 0px auto;
}
.heading_title{
    float: left;
    font-family: Arial,Helvetica, sans-serif;
    font-size: 30px;
    color: burlywood;
}
.heading_nav{
    padding-bottom: 30px;
    padding-top: 30px;
    width: 100%;
    height: 30px;
    position: relative;
}
ul{
    margin-left: 40px;
    float:left;
    list-style-type: none;
    padding-top: 6px;
    padding-bottom: 6px;
}
li{
    padding-left: 10px;
    display: inline;
}
a:link,a:visited{
    font-weight: bold;
    color: darkgray;
    text-align: center;
    padding: 6px;
    text-decoration: none;
}
a:hover,a:active{
    color:dimgray;
}
.heading_img img{
    border-radius: 30px;
    display: inline;
    width: 26px;
    height: 26px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.2);
    float: right;
}
.heading_soptlight form{
    float: right;
    width: 100px;
    height: 26px;
    position: relative;
    margin-right: 50px;
}
form input{
    float: right;
    height: 26px;
    border-radius: 30px;
}
.body{
    width: auto;
    height: auto;
    padding: 30px;
}
.body_title h3{
    font-size: 30px;
    font-family: Arial, Helvetica, sans-serif;
    color: #333333;
}
.body_title p{
    margin-top: 20px;
    margin-bottom: 20px;
}
.footing{
    padding-top: 20px;
    text-align: center;
    font-size: 10px;
    color: darkgray;
}
时间: 2024-08-05 05:19:35

HTML与CSS绘制简单DIV布局的相关文章

css基础-2 div布局

div布局 <html> <head> <title>div布局 </title> <meta charset="utf-8"> <style> .toubu {width:100%;height:100px;background:aqua;} .zhuti {width:80%;height:600px;background:red;float:left;} .left  {width:20%;height:60

css+html简单的布局demo

于html介绍css作风.可以改变html块状布局,局更加美观.接下来看一个基础布局的小样例: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>margin布局</title> </head> <style type="text/css"

用CSS绘制简单图形

这里有篇文章, https://css-tricks.com/examples/ShapesOfCSS/  ,介绍了如何用只用1个元素和CSS规则绘制各种常见的图形: 从简单的矩形.三角形到复杂的月亮.放大镜甚至是太极图.  这种绘图方式主要用到了两类技巧: 一是使用伪元素, 二是设置图形的边框.特别是边框的使用,非常巧妙.从这些例子中可以发现:当元素的宽.高设置为0时,浏览器仍然会渲染元素的边框(即便box-sizing设置为了border-box,这时实际的宽/高会是边框的厚度之和),巧妙设

纯css绘制简单几何图案

下面有四种形状的图案,其中梯形和三角形是为了可以一目了然地看到实现的原理.     废话不多说,直接上代码吧. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .box {margin:10px;} .box1 {width:100px;hei

DIV+CSS 样式简单布局Tab 切换

<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="../JS/JQuery/jquery-1.9.1.js" type="text/javascript"></script> <style type="

CSS篇之DIV+CSS布局

<div></div> div与其他标签一样,也是一个XHTML所支持的标签. div是XHTML中指定的,远门用于布局设计的容器标记. 简单的CSS布局 头部 内容 页脚 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css">

css练习 简单布局

<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link href="style/style.css" rel="stylesheet" type="text

CSS+DIV布局中absolute和relative区别

http://developer.51cto.com/art/201009/225201.htm CSS+DIV布局中absolute和relative区别 这里向大家简单介绍一下CSS+DIV布局中absolute和relative属性的用法和区别,定位为relative的元素脱离正常的文本流中,但其在文本流中的位置依然存在,而定位为absolute的层脱离正常文本流,但与relative的区别是其在正常流中的位置不在存在. 详解CSS+DIV布局定位 在用CSS+DIV进行布局定位的时候,一

用div和css样式控制页面布局

1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 5 <title>网页布局练习</title> 6 7 <link href=&qu