Table of Contents
黄石港区各类人数统计
Home Web Front-end HTML Tutorial 项目:(前端部分)制作一个导航目录表格,统计黄石港区各社区各类人数_html/css_WEB-ITnose

项目:(前端部分)制作一个导航目录表格,统计黄石港区各社区各类人数_html/css_WEB-ITnose

Jun 24, 2016 am 11:33 AM

一、设计表格样式

目标:定义表格的宽度、字体、背景颜色等。

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 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     <style type="text/css"> 7         table.hovertable { 8             font-family: verdana,arial,sans-serif; 9             font-size:11px;10             color:#333333;11             border-width: 1px;12             border-color: #999999;13             border-collapse: collapse;14         }15         table.hovertable th {16             background-color:#c3dde0;17             border-width: 1px;18             padding: 8px;19             border-style: solid;20             border-color: #a9c6c9;21         }22         table.hovertable tr {23             background-color:#d4e3e5;24         }25         table.hovertable td {26             border-width: 1px;27             padding: 8px;28             border-style: solid;29             border-color: #a9c6c9;30         }31     </style>32 </head>
Copy after login

知识拓展:
1、font-family:

  CSS中font-family用来定义页面字体,一般定义3-4个(比如:font-family: verdana,arial,helvetica,sans-serif; )。第一个优先级最高。这样如果访问你网页的电脑没有安装你定义的第一个字体,它会用第二个,以此类推。如果都找不到,就用浏览器的默认字体显示你的网页。通常推荐字体:黑体、宋体、微软雅黑、Arial, Helvetica, sans-serif。

2、html5表格的使用:

表格 描述
定义表格
定义表格标题
定义表格的表头
定义表格的行
定义表格的单元
定义表格的页眉
定义表格的主体
定义表格的页脚
定义表格的列属性

3、CSS border-style属性:

  设置 4 个边框的样式

  

  最不可预测的边框样式是 double。它定义为两条线的宽度再加上这两条线之间的空间等于 border-width 值。不过,CSS 规范并没有说其中一条线是否比另一条粗或者两条线是否应该是一样的粗,也没有指出线之间的空间是否应当比线粗。所有这些都有用户代理决定,创作人员对这个决定没有任何影响。

4、border-collapse: collapse:

    为表格设置合并边框模型

  

二、设计表格效果

目标:将表格的表头加粗,鼠标移到某一行时会改变该行的颜色,鼠标移开则恢复原色。

 1 <body bgcolor="#9999FF"> 2     <div class="head"> 3         <hr /> 4         <h1 id="黄石港区各类人数统计">黄石港区各类人数统计</h1> 5         <hr /> 6     </div> 7     <div class="center"> 8         <table class="hovertable"> 9             <tr>10                 <th>社区</th><th>民主党派</th><th>无党派</th><th>党外知识分子</th><th>宗教人士</th><th>少数民族流动人口</th>11                 <th>少数民族常住人口</th><th>非公有制经济人士</th><th>新的社会阶层人士</th><th>出国和归国留学人员</th><th>港澳同胞(家属)</th>12                 <th>台湾同胞(家属)</th><th>华侨/归侨/侨眷</th>13             </tr>14             <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">15                 <td><a href="#">江北社区</a></td><td></td><td></td><td></td><td></td>16                 <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>17             </tr>18             <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">19                 <td><a href="#">天方社区</a></td><td></td><td></td><td></td><td></td><td></td>20                 <td></td><td></td><td></td><td></td><td></td><td></td><td></td>21             </tr>22             <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">23                 <td><a href="#">天虹社区</a></td><td></td><td></td><td></td><td></td><td></td><td></td>24                 <td></td><td></td><td></td><td></td><td></td><td></td>25             </tr>26             <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">27                 <td><a href="#">大码头社区</a></td><td></td><td></td><td></td><td></td><td></td><td></td>28                 <td></td><td></td><td></td><td></td><td></td><td></td>29             </tr>30             <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">31                 <td><a href="#">老虎头社区</a></td><td></td><td></td><td></td><td></td><td></td><td></td>32                 <td></td><td></td><td></td><td></td><td></td><td></td>33             </tr>34             <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">35                 <td><a href="#">锁前社区</a></td><td></td><td></td><td></td><td></td><td></td><td></td>36                 <td></td><td></td><td></td><td></td><td></td><td></td>37             </tr>38             <tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">39                 <td><a href="#">花湖社区</a></td><td></td><td></td><td></td><td></td><td></td><td></td>40                 <td></td><td></td><td></td><td></td><td></td><td></td>41             </tr>42         </table>43     </div>44 </body>45 </html>    
Copy after login

知识拓展:

1、javascript中onmouseover和onmouseout事件:

       onmouseover 用户鼠标移入元素时触发的事件。并执行onmouseover调用的函数。

      onmouseout 用户鼠标移开元素时触发的事件。并执行onmouseout调用的函数。

  HTML中可以用这两个事件改变背景颜色或者背景图片,例如:

  (1)用onmouseout onmouseover 图像间相互变换:

1 <imagesrc="img1"onmouseover="this.src='img2'"onmouseout="this.src='img1'">
Copy after login

  (2)onmouseover onmouseout 改变文字背景色:

1 <div width="100" height="100" onmouseover="style.backgroundColor='#fff'"2 onmouseout="style.backgroundColor='#bbb'" bgcolor="#bbb">文字</div>
Copy after login

  (3)onmouseover onmouseout 改文字变背景图:

1 <div width="100" height="100" onMouseOver="this.background='1.gif'"2 onMouseOut="this.background='2.gif'" background="2.gif">文字</div>3 <image src="img1" onmouseover="this.src='img2'" onmouseout="this.src='img1'">
Copy after login

 

 

 

三、完成效果

1、打开效果

 

2、鼠标放上去的效果:

 

 

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1665
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

HTML: The Structure, CSS: The Style, JavaScript: The Behavior HTML: The Structure, CSS: The Style, JavaScript: The Behavior Apr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML, CSS, and JavaScript: Web Development Trends The Future of HTML, CSS, and JavaScript: Web Development Trends Apr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The Future of HTML: Evolution and Trends in Web Design The Future of HTML: Evolution and Trends in Web Design Apr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative Overview HTML vs. CSS vs. JavaScript: A Comparative Overview Apr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Building the Structure of Web Pages HTML: Building the Structure of Web Pages Apr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML vs. CSS and JavaScript: Comparing Web Technologies HTML vs. CSS and JavaScript: Comparing Web Technologies Apr 23, 2025 am 12:05 AM

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTML: Is It a Programming Language or Something Else? HTML: Is It a Programming Language or Something Else? Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

See all articles