• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Web Rebuild
 

Web Rebuild

on

  • 881 views

网站重构初学者材料

网站重构初学者材料

Statistics

Views

Total Views
881
Views on SlideShare
802
Embed Views
79

Actions

Likes
1
Downloads
12
Comments
0

2 Embeds 79

http://blog.silentash.com 76
http://www.slideshare.net 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Web Rebuild Web Rebuild Presentation Transcript

    • WEB重构
      渔隐 , TaobaoUED
    • 了解WEB重构前需要知道的一些内容
    • table
    • The HTML table model allows authors to arrange data -- text, preformatted text, images, links, forms, form fields, other tables, etc. -- into rows and columns of cells.
      W3C :
      http://www.w3.org/TR/html401/struct/tables.html#h-11.1
    • 整理数据很方便
    • Table布局
    • 为何不建议用table布局?
    • W3C:
      Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. …To minimize these problems, authors should use style sheets to control layout rather than tables.
    • 是表格而非栅格
    • 1.不够语义 2.维护性差3.不利于搜索引擎优化4.代码臃肿5.可访问性差
    • 请不要排斥table
      Table没有错,错的是拿table做布局的人
    • Div和Span
    • The DIV and SPAN elements, in conjunction with the id and class attributes, offer a generic mechanism for adding structure to documents. These elements define content to be inline (SPAN) or block-level (DIV) but impose no other presentational idioms on the content. Thus, authors may use these elements in conjunction with style sheets, the lang attribute, etc., to tailor HTML to their own needs and tastes.
      http://www.w3.org/TR/html401/struct/global.html#h-7.5.4
    • 每个html标签都有其特有含义
    • WEB重构:还标签本意,结构、表现、行为相分离
    • 标题
      强调
      表格
      段落
      列表
      表单
      在拿到设计稿时,首先应该考虑的不是表现,而是结构
    • <h3>标题</h3>
      <img />
      <h4>小标题</h4>
      <p>内容</p>
      <ul>
      <li></li>
      </ul>
      <h3>标题</h3>
      <table>表格</table>
      <h3>标题</h3>
      <fieldset>
      <form>
      <input />
      </form>
      </fieldset>
      还原语义,从代码上理解网页
    • 基本HTML结构
    • 1.Html版本信息—文档类型(doctype)
      2.Html元素
      3.文档头head标签
      4.文档内容body标签
      <!DOCTYPE html>
      <html>
      <head>
      <title></title>
      </head>
      <body>
      </body>
      </html>
    • Doctype,Html,head,body顺序固定且唯一
    • Doctype很不起眼,但很重要
      http://www.chencheng.org/blog/2010/01/15/ppt-detail-on-html-spec/
      http://blog.silentash.com/2010/01/html5-doctype-and-img-space/
    • 好的结构是一切的基础
    • <!DOCTYPE html>
      <html>
      <head>
      <title>文档标题</title>
      </head>
      <body>
      <h3>标题</h3>
      <img />
      <h4>小标题</h4>
      <p>内容</p>
      <ul>
      <li></li>
      </ul>
      <h3>标题</h3>
      <table>表格</table>
      <h3>标题</h3>
      <fieldset>
      <form>
      <input />
      </form>
      </fieldset>
      </body>
      </html>
    • 分离表现
      <h3 style=“border:1px dashed #f00”>标题</h3>
      to
      <style>
      h3{
      border:1px dashed #f00;
      }
      </style>
      <h3>标题</h3>
    • 分离脚本
      <button onclick=“javascript:alert(‘hello world’)”>hello world</button>
      to
      <button id=“someid” >hello world</button>
      <script>
      document.getElementById(‘someid’).onclick = function(){
      alert(‘hello world’);
      }
      </script>
    • <!DOCTYPE html>
      <html>
      <head>
      <title>文档标题</title>
      <style>
      h3{color:#f00}
      </style>
      </head>
      <body>
      <h3>标题</h3>
      <img />
      <h4>小标题</h4>
      <p>内容</p>
      <ul>
      <li></li>
      </ul>
      <h3>标题</h3>
      <table>表格</table>
      <h3>标题</h3>
      <fieldset>
      <form>
      <input id=“someid” />
      </form>
      </fieldset>
      <script> document.getElementById(‘someid’).onclick=function(){
      Some coding…
      }
      <script>
      </body>
      </html>
    • 将表现和脚本分离到外部文件
    • <!DOCTYPE html>
      <html>
      <head>
      <title>文档标题</title>
      <link type=“text/css” rel=“stylesheet” href=“style.css” />
      </head>
      <body>
      <h3>标题</h3>
      <img />
      <h4>小标题</h4>
      <p>内容</p>
      <ul>
      <li></li>
      </ul>
      <h3>标题</h3>
      <table>表格</table>
      <h3>标题</h3>
      <fieldset>
      <form>
      <input id=“someid” />
      </form>
      </fieldset>
      <script src=“code.js” type=“text/javascript” ></script>
      </body>
      </html>
    • 兼容性调整,前端开发赖以生存的基本技能
    • 淘宝网用户浏览器分布图,19日摘自哈勃系统
    • 淘宝网用户屏幕分辨率分布图,19日摘自哈勃系统
    • 从浏览器趋势可以看出,IE6虽逐步消亡,却依旧强势
    • 为用户而设计是设计师和前端开发共同的目标
    • 路漫漫其修远兮……
    • THX!