<1> 首页展示
<1> table 表格标签
<2> 通过 table 表格标签布局分析
<3>进一步分析第四部分(第六部分)
<tr>
<td>
<table width="100%">
<tr>
<td colspan="7" width="100%">
<h3>最新商品<img src="..."/>h3>
td>
tr>
<tr align="center">
<td rowspan="2">
<img src="..." height="100%" width="100%"/>
td>
<td colspan="3">
<img src="..." height="100%" width="100%"/>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
tr>
<tr align="center">
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
tr>
table>
td>
tr>
<4> 网页完整代码实现
当然,第一次进行布局的时候,我们可以在每个table 标签中添加 border="1px"属性展示表格的框线,这样可以更好的呈现出整个页面的布局。
<table width="100%" border="1px">
<tr>
<td>td>
tr>
table>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>网站首页table布局title>
head>
<body>
<table width="100%">
<tr>
<td>
<table width="100%">
<tr>
<td>
<img src="..."/>
td>
<td>
<img src="..."/>
td>
<td>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">登录a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">注册a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">购物车a>
td>
tr>
table>
td>
tr>
<tr bgcolor="black">
<td height="50px">
<a href="https://blog.csdn.net/SolarL/article/details/89852420"><font color="white">首页font>a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420"><font color="white">手机数码font>a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420"><font color="white">电脑办公font>a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420"><font color="white">美肤美容font>a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420"><font color="white">鞋靴皮箱font>a>
td>
tr>
<tr>
<td>
<img src="..." width="100%"/>
td>
tr>
<tr>
<td>
<table width="100%">
<tr>
<td colspan="7" width="100%">
<h3>最新商品<img src="..."/>h3>
td>
tr>
<tr align="center">
<td rowspan="2">
<img src="..." height="100%" width="100%"/>
td>
<td colspan="3">
<img src="..." height="100%" width="100%"/>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
tr>
<tr align="center">
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
tr>
table>
td>
tr>
<tr>
<td>
<img src="..." height="100%" width="100%"/>
td>
tr>
<tr>
<td>
<table width="100%">
<tr>
<td colspan="7" width="100%">
<h3>最新商品<img src="..."/>h3>
td>
tr>
<tr align="center">
<td rowspan="2">
<img src="..." height="100%" width="100%"/>
td>
<td colspan="3">
<img src="..." height="100%" width="100%"/>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
tr>
<tr align="center">
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
<td>
<img src="..."/>
<p>洗衣机p>
<p><font color="red">$998font>p>
td>
tr>
table>
td>
tr>
<tr>
<td>
<img src="..." height="100%" width="100%"/>
td>
tr>
<tr>
<td align="center">
<a href="https://blog.csdn.net/SolarL/article/details/89852420">关于我们a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">联系我们a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420https://blog.csdn.net/SolarL/article/details/89852420">招贤纳士a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">法律声明a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">友情链接a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">支付方式a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">配送方式a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">服务声明a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">广告声明a>
<br/>
Copyright © 2005-2019 版权所有
td>
tr>
table>
body>
html>
<1> DIV+CSS
<style>
选择器{
属性名称:属性的值;
属性名称2: 属性的值2;
}
style>
<2> 通过 DIV+CSS 布局分析
<3>进一步分析第四部分(第六部分)
float属性:
left
right
clear属性: 清除浮动
both : 两边都不允许浮动
left: 左边不允许浮动
right : 右边不允许浮动
流式布局
将整个第四部分的布局可分为,左侧占 width: 15% height: 480px,右侧左上角部分height: 240px; width: 50%,剩余50%放置 width:16%的图片三张,下一行放置6张即可布满整个区域。
<4> 完整代码实现
<html>
<head>
<meta charset="UTF-8">
<title>网站首页DIV+CSS优化title>
//<link rel="stylesheet" type="text/css" href="../css/main.css"/>
<style>
.logo{
float: left;
width: 33%;
/*border-width: 1px;
border-style: solid;
border-color: red;*/
height: 60px;
line-height: 60px;
/* border: 1px solid red;*/
}
.amenu{
color: white;
text-decoration: none;
height: 50px;
line-height: 50px;
}
.product{
float: left;
text-align: center;
width: 16%;
height: 240px;
}
style>
head>
<body>
<div>
<div>
<div class="logo">
<img src="..." height="50px" width="303px"/>
div>
<div class="logo">
<img src="..."/>
div>
<div class="logo">
<a href="https://blog.csdn.net/SolarL/article/details/89852420">登录a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">注册a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">购物车a>
div>
div>
<div style="clear: both;">div>
<div style="background-color: black; height: 50px;">
<a href="https://blog.csdn.net/SolarL/article/details/89852420" class="amenu">首页a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420" class="amenu">手机数码a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420" class="amenu">电脑办公a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420" class="amenu">鞋靴箱包a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420" class="amenu">香烟酒水a>
div>
<div>
<img src="..." width="100%"/>
div>
<div>
<div><h2>最新商品<img src="..."/>h2>div>
<div style="width: 15%; height: 480px; float: left;">
<img src="..." width="100%" height="100%"/>
div>
<div style="width: 84%; height: 480px;float: left;">
<div style="height: 240px; width: 50%; float: left;">
<img src="..." height="100%" width="100%"/>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
div>
div>
<div>
<img src="..." width="100%"/>
div>
<div>
<div><h2>最新商品<img src="..."/>h2>div>
<div style="width: 15%; height: 480px; float: left;">
<img src="..." width="100%" height="100%"/>
div>
<div style="width: 84%; height: 480px;float: left;">
<div style="height: 240px; width: 50%; float: left;">
<img src="..." height="100%" width="100%"/>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
<div class="product">
<img src="..."/>
<p>高压锅p>
<p style="color: red;">$998p>
div>
div>
div>
<div>
<img src="..." width="100%"/>
div>
<div style="text-align: center;">
<a href="https://blog.csdn.net/SolarL/article/details/89852420">关于我们a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">联系我们a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">招贤纳士a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">法律声明a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">友情链接a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">支付方式a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">配送方式a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">服务声明a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">广告声明a>
<br/>
Copyright © 2005-2019 SolarL 版权所有
div>
div>
body>
html>
<1> JS 开发
<2> 实现分析
<html lang="en">
<head>
<meta charset="UTF-8">
<title>图片轮播title>
<script>
/* 当页面加载完成的时候, 动态切换图片
1.确定事件:
2.事件所要触发的函数
*/
var index = 1;
//切换图片
function changeAd() {
//获取要操作的img
var img = document.getElementById("imgAd");
img.src = "../img/"+(index%3+1)+".JPG";
index++;
}
function init() {
//启动定时器
setInterval("changeAd()",3000);
}
script>
head>
<body onload="init()">
<img src="../img/1.JPG" id="imgAd"/>body>
html>
<1> BootStrap 结构
<2> Bootstrap 栅格系统
.container
(固定宽度)或 .container-fluid
(100% 宽度)中,以便为其赋予合适的排列(aligment)和内补(padding)。.row
和 .col-xs-4
这种预定义的类,可以用来快速创建栅格布局。Bootstrap 源码中定义的 mixin 也可以用来创建语义化的布局。padding
属性,从而创建列与列之间的间隔(gutter)。通过为 .row
元素设置负值 margin
从而抵消掉为 .container
元素设置的 padding
,也就间接为“行(row)”所包含的“列(column)”抵消掉了padding
<2> Bootstrap 的入门开发
<link rel="stylesheet" href="../css/bootstrap.css" />
<script type="text/javascript" src="../js/jquery-1.11.0.js" >script>
<script type="text/javascript" src="../js/bootstrap.js" >script>
<meta name="viewport" content="width=device-width, initial-scale=1">
.container
类用于固定宽度并支持响应式布局的容器。
<div class="container">
...
div>
.container-fluid` 类用于 100% 宽度,占据全部视口(viewport)的容器。
<div class="container-fluid">
...
div>
<3> Bootstrap框架实现响应式网站首页及轮播图
<html lang="en">
<head>
<meta charset="UTF-8">
<title>响应式网站首页title>
<link href="../css/bootstrap.css" rel="stylesheet">
<script src="../js/jquery-1.11.0.js" type="text/javascript">script>
<script src="../js/bootstrap.js" type="text/javascript">script>
<meta name="viewport" content="width=device-width, initial-scale=1">
head>
<body>
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-6">
<img src="../img/logos.png" height="60px"/>
div>
<div class="col-md-4 hidden-sm hidden-xs">
<img src="../img/header.png"/>
div>
<div class="col-md-4 col-sm-6 col-xs-6" style="line-height: 50px;height: 50px;">
<a href="https://blog.csdn.net/SolarL/article/details/89852420">登录a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">注册a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">购物车a>
div>
div>
<nav class="navbar navbar-inverse" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1">
<span class="s r-only">Toggle navigationspan>
<span class="icon-bar">span>
<span class="icon-bar">span>
<span class="icon-bar">span>
button>
<a class="navbar-brand" href="https://blog.csdn.net/SolarL/article/details/89852420">首页a>
div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">
<a href="https://blog.csdn.net/SolarL/article/details/89852420">手机数码<span class="sr-only">(current)span>a>
li>
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">电脑办公a>
li>
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">鞋靴箱包a>
li>
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">香烟酒水a>
li>
<li class="dropdown">
<a href="https://blog.csdn.net/SolarL/article/details/89852420" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">全部分类
<span class="caret">span>a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">手机数码a>
li>
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">电脑办公a>
li>
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">鞋靴皮箱a>
li>
<li class="divider">li>
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">香烟酒水a>
li>
<li class="divider">li>
<li>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">其他分类a>
li>
ul>
li>
ul>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="请输入要搜素的商品">
div>
<button type="submit" class="btn btn-default">搜索button>
form>
div>
div>
nav>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="2000">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active">li>
<li data-target="#carousel-example-generic" data-slide-to="1">li>
<li data-target="#carousel-example-generic" data-slide-to="2">li>
ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="../img/1.jpg" alt="...">
<div class="carousel-caption">
大促销
div>
div>
<div class="item">
<img src="../img/2.jpg" alt="...">
<div class="carousel-caption">
大促销
div>
div>
<div class="item">
<img src="../img/3.jpg" alt="...">
<div class="carousel-caption">
大促销
div>
div>
div>
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true">span>
<span class="sr-only">Previousspan>
a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true">span>
<span class="sr-only">Nextspan>
a>
div>
<div class="row">
<div class="col-md-12">
<h3>最新商品 <img src="../img/title2.jpg"/>h3>
div>
div>
`
<div class="row">
<div class="col-md-2 hidden-sm hidden-xs" style="height: 480px">
<img src="../img/big01.jpg"/>
div>
<div class="col-md-10">
<div class="col-md-6 hidden-sm hidden-xs" style="height: 240px">
<img src="../img/middle01.jpg"/>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
div>
div>
<div class="row">
<div class="col-md-12">
<img src="../img/ad.jpg" width="100%"/>
div>
div>
<div class="row">
<div class="col-md-12">
<h3>最新商品<img src="../img/title2.jpg"/>h3>
div>
div>
<div class="row">
<div class="col-md-2 hidden-sm hidden-xs" style="height: 480px;">
<img src="../img/big01.jpg"/>
div>
<div class="col-md-10">
<div class="col-md-6 hidden-sm hidden-xs" style="height: 240px;">
<img src="../img/middle01.jpg"/>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small09.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small08.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small07.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small06.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small05.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small04.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small03.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small02.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
<div class="col-md-2 col-sm-4 col-xs-6" style="text-align: center;height: 240px;">
<img src="../img/small01.jpg"/>
<p>微波炉p>
<p style="color: red;">$998p>
div>
div>
div>
<div class="row">
<div class="col-md-12">
<img src="../img/footer.jpg" width="100%"/>
div>
div>
<div style="text-align: center;">
<a href="https://blog.csdn.net/SolarL/article/details/89852420">关于我们a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">联系我们a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">招贤纳士a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">法律声明a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">友情链接a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">支付方式a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">配送方式a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">服务声明a>
<a href="https://blog.csdn.net/SolarL/article/details/89852420">广告声明a>
<br/>
Copyright © 2005-2019
<p>SolarL 版权所有p>
div>
div>
body>
html>