HTML+CSS的练习之网上书城主页面的实现

2024-02-07 06:48

本文主要是介绍HTML+CSS的练习之网上书城主页面的实现,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

博主终于把CSS学完了,废话不说,先上代码~

 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>bookStore</title>
<style type="text/css">.clear{clear:both;}#top_left{width:300px;float: left;}#top_right{width:400px;float: right;margin-top:15px;font-size: 13px;}#top_right img{margin-bottom: -5px;}#top_right a{text-decoration: none;color:#06F;}#top_right a:hover{color:#909;}#menu{background-color: #1C3F09;border-top:5px solid #82B211;padding: 10px 0px;text-align: center;}#menu a{margin: 0 8px;color: #fff;text-decoration: none;font-weight: bold;font-size: 15px;}#menu a:hover{color: #999;}#menu .all{color: yellow}#search{background-color: #B6B684;padding:7px 0;text-align: right;}#search input[type='image']{/* margin-top: 5px; */margin-right: 250px;margin-bottom: -4px;}#search input[type='text']{height: 16px;border:1px solid #999;}/*-------------------------------------------------------*/#content{width:900px;margin:8px auto 15px;/*auto div居中*/}#content_top{text-align: right;font-size:13px;}#content_bottom{border:1px solid #999;background-color: #FCFDEF;padding:10px 15px;}#content_bottom h1{font-size: 15px;display: inline;}#content_bottom span{font-size: 13px;}#productlist_img img{width: 100%;}.book{float: left;width: 25%;text-align: center;padding:10px 0px;}.bookimg img{width: 130px;height: 196px;}#jumpPage{text-align: center;margin: 10px;}#jumpPage a{padding:2px 6px;border: 1px solid #9AAFE5;text-decoration: none;color:#9AAFE5;}#jumpPage a:hover{color:#2B66A5;border: 1px solid #2B66A5;}.current{background-color: blue;}/*-------------------------------------------------------*/#bottom{background-color: #EFEEDC;height:60px;padding:10px 0px;}#bottom_left{width: 400px;float: left;margin-left: 200px;}#bottom_right{width: 500px;float: left;line-height:28px;/*行高*/}</style>
</head>
<body><div id="page"><div id="top"><div id="top_left"><img alt="" src="images/logo.png"></div><div id="top_right"><img alt="" src="images/cart.gif"><a href="#">购物车</a>|<a href="#">帮助中心</a>|<a href="#">我的账户</a>|<a href="#">新用户注册</a></div></div><div class="clear"></div><div id="menu"><a href="#">文学</a><a href="#">生活</a><a href="#">计算机</a><a href="#">外语</a><a href="#">经管</a><a href="#">励志</a><a href="#">社科</a><a href="#">学术</a><a href="#">少儿</a><a href="#">艺术</a><a href="#">原版</a><a href="#">科技</a><a href="#">考试</a><a href="#">生活百科</a><a class="all" href="#">全部目录商品</a></div><div id="search"><span>Search</span><input type="text" /><input type="image" src="images/serchbutton.gif" /></div><div id="content"><div id="content_top"><span>首页 > 旅游 > 图书列表 </span></div><div id="content_bottom"><h1>商品目录</h1><hr/><h1>计算机类</h1><span>共100种商品</span><hr/><div id="productlist"><div id="productlist_img"><img alt="" src="images/productlist.gif" width="100%"></div><div id="booklist"><div class="book"><div class="bookimg"><img alt="" src="bookcover/101.jpg"></div><div class="bookIntr"><span>书名:xxx</span><br/><span>售价:xxx</span></div></div><div class="book"><div class="bookimg"><img alt="" src="bookcover/102.jpg"></div><div class="bookIntr"><span>书名:xxx</span><br/><span>售价:xxx</span></div></div><div class="book"><div class="bookimg"><img alt="" src="bookcover/103.jpg"></div><div class="bookIntr"><span>书名:xxx</span><br/><span>售价:xxx</span></div></div><div class="book"><div class="bookimg"><img alt="" src="bookcover/104.jpg"></div><div class="bookIntr"><span>书名:xxx</span><br/><span>售价:xxx</span></div></div><div class="book"><div class="bookimg"><img alt="" src="bookcover/105.jpg" width="102"></div><div class="bookIntr"><span>书名:xxx</span><br/><span>售价:xxx</span></div></div><div class="book"><div class="bookimg"><img alt="" src="bookcover/106.jpg" width="102"></div><div class="bookIntr"><span>书名:xxx</span><br/><span>售价:xxx</span></div></div><div class="book"><div class="bookimg"><img alt="" src="bookcover/107.jpg"></div><div class="bookIntr"><span>书名:xxx</span><br/><span>售价:xxx</span></div></div><div class="book"><div><img alt="" src="bookcover/108.jpg" width="130"></div><div><span>书名:xxx</span><br><span>售价:xxx</span></div></div><div class="clear"></div><div id="jumpPage"><a href="#">上一页</a><a class="current" href="#">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">7</a><a href="#">下一页</a></div></div></div></div></div><div id="bottom"><div id="bottom_left"><img alt="" src="images/logo.png"></div><div id="bottom_right"><span>CONTACT US</span><br/><span>copyright 2017 &copy; striner All Rights RESERVED</span></div></div></div>
</body>
</html>

 

 

接下来,我对CSS做一个小小的总结.不全面之处大家勿怪~

 

CSS官方的定义为"层叠样式表".引入方式一共分为四种:

常用的分为内嵌样式,内部样式,外部样式三总,外加@import不常用方式一种.这四种是针对CSS与HTML文件的关系而划分.

这里我采用外部样式在<head>标签中使用<stytle>标签将CSS进行引入.

 

CSS选择器分为基本选择器(元素选择器,id选择器,class选择器),属性选择器,伪元素选择器三种.

其中,元素选择器书写语法为: html标签名 {CSS属性}

id选择器书写语法为: #(id) {CSS属性}

class选择器书写语法为: .class的值 {CSS属性}

属性选择器语法为: 基本选择器[属性='属性值'] {CSS属性}

 

伪元素选择器最为有趣,可以使一个对象根据鼠标悬浮点击事件分为四个状态: 静止,悬浮,触发,完成

当鼠标不触及该元素时,可使用 a:link {CSS属性} 对其进行设置    -----静止状态

当鼠标触及该控件时,可使用 a:hover {CSS属性} 对其进行设置    -----悬浮状态

当鼠标点击事件发生时,可使用 a:active {CSS属性} 对其进行设置    -----触发状态

当点击事件完成时,可使用 a:visited {CSs属性} 对其进行设置    -----完成状态

 

至于CSS的七大属性以及它的盒子模型(border,padding,margin)我暂且略去不谈.

接下来,就上效果图吧~

emmm,这里放上我用纯HTML写的页面博客链接地址:http://blog.csdn.net/striner/article/details/78605405

用木有发现加上CSS之后页面比之前更好看了,我将"全部目录商品"修改为了黄色,top部分还使用了盒子模型对其位置进行了修饰,部分元素我还对其设置了不同颜色的悬浮状态,效果图如下:

      

 

了解相关git代码请移步:https://github.com/striner/striner.github.io/tree/master/bookStore

想查看具体效果请移步:https://striner.github.io/bookStore/index.html#

 

喜欢就请关注我,你们的关注是我最大的动力~

这篇关于HTML+CSS的练习之网上书城主页面的实现的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/686851

相关文章

基于C++的UDP网络通信系统设计与实现详解

《基于C++的UDP网络通信系统设计与实现详解》在网络编程领域,UDP作为一种无连接的传输层协议,以其高效、低延迟的特性在实时性要求高的应用场景中占据重要地位,下面我们就来看看如何从零开始构建一个完整... 目录前言一、UDP服务器UdpServer.hpp1.1 基本框架设计1.2 初始化函数Init详解

Java中Map的五种遍历方式实现与对比

《Java中Map的五种遍历方式实现与对比》其实Map遍历藏着多种玩法,有的优雅简洁,有的性能拉满,今天咱们盘一盘这些进阶偏基础的遍历方式,告别重复又臃肿的代码,感兴趣的小伙伴可以了解下... 目录一、先搞懂:Map遍历的核心目标二、几种遍历方式的对比1. 传统EntrySet遍历(最通用)2. Lambd

springboot+redis实现订单过期(超时取消)功能的方法详解

《springboot+redis实现订单过期(超时取消)功能的方法详解》在SpringBoot中使用Redis实现订单过期(超时取消)功能,有多种成熟方案,本文为大家整理了几个详细方法,文中的示例代... 目录一、Redis键过期回调方案(推荐)1. 配置Redis监听器2. 监听键过期事件3. Redi

SpringBoot全局异常拦截与自定义错误页面实现过程解读

《SpringBoot全局异常拦截与自定义错误页面实现过程解读》本文介绍了SpringBoot中全局异常拦截与自定义错误页面的实现方法,包括异常的分类、SpringBoot默认异常处理机制、全局异常拦... 目录一、引言二、Spring Boot异常处理基础2.1 异常的分类2.2 Spring Boot默

基于SpringBoot实现分布式锁的三种方法

《基于SpringBoot实现分布式锁的三种方法》这篇文章主要为大家详细介绍了基于SpringBoot实现分布式锁的三种方法,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录一、基于Redis原生命令实现分布式锁1. 基础版Redis分布式锁2. 可重入锁实现二、使用Redisso

SpringBoo WebFlux+MongoDB实现非阻塞API过程

《SpringBooWebFlux+MongoDB实现非阻塞API过程》本文介绍了如何使用SpringBootWebFlux和MongoDB实现非阻塞API,通过响应式编程提高系统的吞吐量和响应性能... 目录一、引言二、响应式编程基础2.1 响应式编程概念2.2 响应式编程的优势2.3 响应式编程相关技术

C#实现将XML数据自动化地写入Excel文件

《C#实现将XML数据自动化地写入Excel文件》在现代企业级应用中,数据处理与报表生成是核心环节,本文将深入探讨如何利用C#和一款优秀的库,将XML数据自动化地写入Excel文件,有需要的小伙伴可以... 目录理解XML数据结构与Excel的对应关系引入高效工具:使用Spire.XLS for .NETC

Nginx更新SSL证书的实现步骤

《Nginx更新SSL证书的实现步骤》本文主要介绍了Nginx更新SSL证书的实现步骤,包括下载新证书、备份旧证书、配置新证书、验证配置及遇到问题时的解决方法,感兴趣的了解一下... 目录1 下载最新的SSL证书文件2 备份旧的SSL证书文件3 配置新证书4 验证配置5 遇到的http://www.cppc

Nginx之https证书配置实现

《Nginx之https证书配置实现》本文主要介绍了Nginx之https证书配置的实现示例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起... 目录背景介绍为什么不能部署在 IIS 或 NAT 设备上?具体实现证书获取nginx配置扩展结果验证

SpringBoot整合 Quartz实现定时推送实战指南

《SpringBoot整合Quartz实现定时推送实战指南》文章介绍了SpringBoot中使用Quartz动态定时任务和任务持久化实现多条不确定结束时间并提前N分钟推送的方案,本文结合实例代码给大... 目录前言一、Quartz 是什么?1、核心定位:解决什么问题?2、Quartz 核心组件二、使用步骤1