Head First HTML with Css & XHTML

一、The Language of the Web

  • 注释 <!-- -->
  • Markup Language
  • 浏览器根据默认规则解析HTML并展示网页

二、Meeting the ‘HT’ in HTML

  • <a href= ’ ’ >…</a>
    • a标签的内容只能是text 或者 image
    • href可以是相对路径也可以是URL
      • 相对路径
        相对于当前位置(页面所在文件夹),浏览器自动将相对路径补充为绝对路径
        • . . 表示返回父节点
        • / 表示根节点
  • <img src= ’ ’ / >

三、Web Page Construction

  • <p>
  • <q>和<blockquote>
    • <q>:inline element
    • <blockquote> : block element
  • <br / >
    和<img / >一样属于empty element
  • list
    以下都属于block element
    • ordered list – ol
      • 只能嵌套 <li>
    • unordered list – ul
      • 只能嵌套 <li>
    • list item – li
  • character entity
    • &gt; = >
    • &lt; = <
    • &amp; = &
    • 每个character entity都有number,例如&#100; ,但不一定都有name

四、A trip to Webville

  • domain name
    例如,baidu.com,IP地址相对应的方便记忆的名称,通过DNS将域名解析为IP
  • <a title=’ ’ >…</a>
    • title属性可能与链接的页面的title属性值有关
    • title属性是对页面的描述
  • <a href = 'index.html #id ’ >…</a>
    • 锚定
  • <a target = ’ ’ >…</a>
    • target属性定义页面打开方式
      • _blank : 永远打开新窗体
      • 固定名称 : 相同target值的页面在同一窗体

五、Media

  • <img src = ’ ’ />
    遇到<img / >标签会再次请求服务器
  • JPEG和GIF
    • JPEG
      • 图片及复杂图形
      • 表示的色彩多
      • 有损压缩
      • 不支持透明度
    • GIF
      • 单色及几何图形
      • 最多支持256种颜色
      • 无损压缩
      • 支持透明度
  • <img src = ’ ’ alt = ’ ’ width= ’ ’ height = ’ ’ / >
    • alt属性 : 相当于图片描述
    • width和height属性
      • 布局占位,当获取到图片后,如果不一致会重新布局。
      • 当与实际图片不一致时,会下载原始图片,然后调整至设定大小。
  • 图片过大时可以先展示缩略图,点击后展示高清图
    • <a>可直接链接图片

六、Serious HTML

  • <!DOCTYPE >
  • 使用strict模式可以获得在不同浏览器中的一致性
  • <img>必须有alt属性
  • 必须指定文件类型及字符集 ------ <meta>
  • inline element必须在block element内部
  • <body>内部只能嵌套block element
  • <p>内部不能嵌套block element
  • <blockquote>内部只能嵌套block element
  • 与改变外观有关的html元素不能

七、Putting the ‘X’ into XHTML

  • W3C在HTML 4.01的基础上结合XML的可拓展性(element可自定义)发展起来的
  • element规则通过<html>的xmlns属性指定
  • W3C不再发展XHTML

八、Adding a Little Style

select {
	property1 : value1;
	property2 : value2;
	... : ...
}
  • <link type = ’ text/css ’ ref=’ stylesheet ’ href = ’ ’ / >
  • 部分属性可继承、重写
  • 注释 /* … */
  • 元素选择器 element
  • 类选择器 .class
  • 多个选择器选择同一个
    • 越具体的
    • 同样具体时选择写在越后面的

九、Expanding your Vocabulary

  • font
    • font-family
      • priority list of font
      • 字体名称有空格时用双引号包裹
    • font-size
      • px
      • % / em 相对于祖元素有明确定义过的值
      • small、medium、large
    • font-weight 粗细
      • normal
      • bold
    • font-style
      • italic / not italic
      • oblique / not oblique
      • italic和oblique在部分浏览器上显示效果一致
        • italic 字体斜、special
        • oblique 字体斜
    • color
      控制element的foreground color,即text和border
    • text-decoration 上下划线
      • underline
        • 易与超链接混淆,应使用border-bottom
      • line-through
      • overline
  • color表示方式
    • name 有限
    • rgb( 100% , 100% , 100% )
    • rgb( 255, 255, 255)
    • #cc6600
      • 每两个数字代表 r , g , b
      • 每组数字都相同可简写为 #c60

十、Getting Intimate with Elements

  • line-height
    • px
    • % / em
      相对于font-size
  • box model
    • content area
    • padding
    • border
      • 关于背景的展示只在border范围内部
    • margin
  • background
    • background-image
      • url ( images/background.gif )
    • background-position
      相对于element的位置
    • background-repeat
      控制填充background space
  • border
    • border-style
      • solid
      • dashed
    • border-width 线宽
    • border-color
  • id选择器 #id
  • <link>引入多个stylesheet
    • 继承、重写
    • media属性
      不同设备使用不同stylesheet
      • print
      • screen

十一、Advanced Web Construction

  • 使用<div>进行block element层面的逻辑结构分区
  • width属性控制element的content area的宽度,element的总宽度等于各项相加
  • text-align
    • 只能设置在block element
    • 只对block element内部的各种inline element有效
  • 后代选择器
    • 用空格隔开,例如#elixirs h2
    • 后代而不仅仅是child element
  • 子元素选择器
    • 用>隔开,例如#elixirs > h2
    • 仅仅是child element
  • line-height
    • 如果设定值为 px 或者 % 或者 em,则后代元素直接继承父代的line-height大小
    • 如果设定值直接是number,则后代元素继承的是倍数(相对于后代自身的font-size)
  • padding简写
    • padding : top , right , bottom , left ;
    • padding : top and bottom , left and right ;
  • boder简写
    • border : style width color
    • in any order
  • background简写
    • background : color url repeat position
    • in any order
  • font简写
    • font : font-style font-variant font-weight font-size/line-height font-family
  • 使用<span>进行inline element层面的逻辑结构分区
  • 伪类选择器
    • 根据状态选择,用 : 隔开,例如a:hover
      • hover 悬停
      • link 正常
      • visited 点击
    • 浏览器根据状态自动将element加到某个伪类中
  • 层叠样式表
    • 搜集所有的样式表
    • 与element相关的所有规则
    • 按照author、user、browser的顺序进行分类(其中,author的优先级最高)
      • 可在property value后加 !important 重新设定优先级
    • 在三组内部按照 specificity 进行排序
      • specificity的确定
        • 0 0 0
          • 第一个数代表选择器是否有id
          • 第二个数代表选择器是否有class或者pseudo-class
          • 第三个数代表选择器是否有element name
          • 用逗号分隔的选择器看作多个独立的规则
    • 同一specificity的规则按照出现顺序选取最后出现的

十二、Arranging Elements

  • flow
    • block element从top到bottom
    • inline element从top left到bottom right
      • 水平位置不够时inline element会换行
  • inline element并列放置
    • 每个margin都起作用
  • block element上下放置
    • 会发生collapse,只取最大的margin
    • 只要vertical margin直接接触就会发生collapse,即使是嵌套element,但是如果外层element有border就不会直接接触
  • float
    • 必须设置width
    • 设置了float属性的element会从flow中除去,后续element顶替原位置
    • 后续element内部的inline element依然会以设置了float属性的element为边界
    • inline element也可设置float,如<img>
    • 需要调整HTML结构顺序
    • 可设置clear属性使element移动至其Z方向没有float元素的位置
      • right 元素右侧不与float重叠
    • 由于float元素的width固定,所以当屏幕宽度较小时,后续element的内容还是会挤到后面,展示顺序会被打乱
  • liquid layout
    • width随页面大小改变而改变
  • frozen layout
    • 将页面内容的content的width设为固定值
    • 页面大小改变时内容不会改变
  • jello layout
    • 将页面内容的content的width设为固定值的同时,左右margin设为auto
    • 页面大小改变时内容不会改变,但保持在页面中部
  • absolute positioning
    • 设置position属性为absolute并指定top、right以及width
      • position
        • static 默认设置,有浏览器决定element位置
        • absolute 相对于最近的被position设置过的父元素
        • fixed 相对于浏览器
        • relative 原位置的偏移
    • 该element从flow中移除,inline element也无法获知absolute element
    • z-index属性控制层叠方向位置
    • 无法设置clear属性

十三、Getting Tabular

<table summary= ' description for visully impaired ' >
	<caption>table title</caption>
	<tr><th>head</th></tr>
	<tr><td>content</td></tr>
</table>
  • caption-side 控制caption出现在table的位置,top or bottom
  • table默认存在border-spacing,可通过border-collapse去除
    • border-collapse : collapse;
    • 如果通过设置 border-spacing :0px; 会出现double border,双厚度
  • list
    • list-style-type 控制 list item 序号样式
    • list-style-image:url ( )

十四、Getting Interactive

  • <form action = ’ ’ method = ’ ’ >
    • method
      • GET
        • 变量加在URL后面
        • 有记录
      • POST
        • 数据量大
        • 隐私
  • 通常使用<table>对<form>进行布局,方便
  • <input type = ’ ’ value = ’ ’ / >
    • type
      • text 单行输入框,此时value为输入框初始值
      • submit 此时value为按钮文本值
      • radio 多个radio同一个name表示单选
        • checked = ’ checked ’
      • checkbox.
        • checked = ’ checked ’
      • password
      • file
  • <textarea rows= ’ ’ cols = ’ ’ >default text</textarea>
    • rows / cols 设定的是字符数
  • <label for = ’ ’ >
<fieldset>
	<legend>group label</legend>
	...
</fieldset>
<select>
	<option value=''>text1</option>
	<option value=''>text2</option>
</select>
  • <select>
    • multiple = ’ multiple ’
    • <option>
      • selected = ’ selected ’

十五、The Top Ten Topics

  • more selector
    • pseudo-element
      • p:first-line
      • p:first-letter
    • attribute
      • img[width]
    • by siblings
      • h1 + p 前面是h1的p element
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Tired of reading HTML books that only make sense after you're an expert? Then it's about time you picked up 'Head First HTML with CSS & XHTML' and really learned HTML. You want to learn HTML so you can finally create those Web pages you've always wanted, so you can communicate more effectively with friends, family, fans and fanatic customers. You also want to do it right so you can actually maintain and expand your Web pages over time, and so your Web pages work in all the browsers and mobile devices out there. Oh, and if you've never heard of CSS, that's okay - we won't tell anyone you're still partying like it's 1999 - but if you're going to create Web pages in the 21st century then you'll want to know and understand CSS. Learn the real secrets of creating Web pages, and why everything your boss told you about HTML tables is probably wrong (and what to do instead). Most importantly, hold your own with your co-worker (and impress cocktail party guests) when he casually mentions how his HTML is now strict, and his CSS is in an external style sheet. With 'Head First HTML with CSS & XHTML', you'll avoid the embarrassment of thinking Web-safe colors still matter, and the foolishness of slipping a font tag into your pages. Best of all, you'll learn HTML and CSS in a way that won't put you to sleep. If you've read a 'Head First' book, you know what to expect: a visually-rich format designed for the way your brain works. Using the latest research in neurobiology, cognitive science, and learning theory, this book will load HTML, CSS, and XHTML into your brain in a way that sticks. So what are you waiting for? Leave those other dusty books behind and come join us in Webville. Your tour is about to begin.
在你成为一名行家之后,阅读HTML书籍给你的唯一感受就是厌烦吗?那么现在就是你拿起《深入浅出HTMLCSSXHTML》来真正学习HTML的时候了。这本书展示了学习创建符合工业标准的Web页面的完整历程——然而,除了阅读,你还会玩游戏、拼图、解谜题以及以你从未想象过的方式创建Web页面。并且,你还将学习HTML如何与CSS一起工作。哦,如果你从未听说过CSS,没关系——我们不会告诉其他人你仍然停留在上个世纪末,但是,如果你要创建本世纪的Web页面,那么,你应该了解和熟悉CSS。 《深入浅出HTMLCSSXHTML》能让你避免认为Web-safe颜色还是紧要问题的尴尬,以及不明智地把标记放入你的页面。最大的好处是,你将毫无睡意地学习HTMLXHTMLCSS。如果你曾经读过深入浅出(Head First)系列图书中的任一本,就会知道书中展现的是什么:一个按人脑思维方式设计的丰富的可视化学习模式。本书的编写采用了许多最新的研究,包括神经生物学、认知科学以及学习理论,这使得本书能让HTMLCSS深深地烙印在你的脑海里。 学会创建Web页面的真正诀窍,并认识到为什么你的老板所说的关于HTML表格的一切都有可能是错误的(以及做什么来代替)。最重要的是,在鸡尾酒会上当你的同事随口提及他的HTML现在如何完整以及他的CSS是在外部样式表里时,你表示认同,这会给酒会客人留下深刻的印象。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值