博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CSS Pocket Reference
阅读量:6480 次
发布时间:2019-06-23

本文共 2936 字,大约阅读时间需要 9 分钟。

hot3.png

#CSS Pocket Reference

##CHAPTER 1 Basic Concepts
###Adding Styles to HTML and XHTML
####Inline Styles
In HTML and XHTML, style information can be specified for an individual element via the style attribute. The value of a style attribute is a declaration block (see the section “Rule Structure” on page 5) without the curly braces:

Look out!This text is alarmingly presented!

XML languages may or may not provide an equivalent capability; always check the language DTD to be certain.

###Embedded Style Sheets A style sheet can be embedded at the top of an HTML or XHTML document using the style element, which must appear within the head element.XML languages may or may not provide an equivalent capability; always check the language DTD to be certain.
###External Style Sheets
Another key advantage is that external style sheets are cached, which can help reduce bandwidth usage. An external style sheet can be referenced in one of the following three ways:

  • @import directive

    <head><title>My Document</title> <style type="text/css"> @import url(site.css); @import url(navbar.css); @import url(footer.css); body {background: yellow;} </style> </head>

Note that @import directives can appear at the top (and, according to the specification, only at the top) of any style sheet. Thus, one style sheet could import another, which in turn would import a third.

  • link element

    <head> <title>A Document</title> <link rel="stylesheet" type="text/css" href="basic.css" media="all"> <link rel="stylesheet" type="text/css" href="web.css" media="screen"> <link rel="stylesheet" type="text/css" href="paper.css" media="print"> </head>

It is also possible to link to alternate style sheets. If alternate style sheets are supplied, it is up to the user agent (or the author) to provide a means for the user to select one of the alternates:

A Document

*xml-stylesheet processing instruction

In XML documents (such as XHTML documents sent with a mime-type of “text/xml,” “application/xml,” or “application/ xhtml+xml”), an xml-stylesheet processing instruction can be used to associate a style sheet with a document. Any xml-style sheet processing instructions must be placed in the prolog of an XML document. Multiple xml-stylesheet processing instructions are permitted. The media pseudo-attribute can be used to restrict a style sheet to one or more forms of media:

<?xml-stylesheet type="text/css" href="basic.css" media="all"?>

<?xml-stylesheet type="text/css" href="web.css" media="screen"?>

<?xml-stylesheet type="text/css" href="paper.css" media="print"?>

It is also possible to link to alternate style sheets with the xmlstylesheet processing instruction:

<?xml-stylesheet type="text/css" href="basic.css"?>

<?xml-stylesheet alternate="yes" title="Classic" type="text/css" href="oldschool.css"?>

<?xml-stylesheet alternate="yes" title="Futuristic" type="text/css" href="3000ad.css"?>

转载于:https://my.oschina.net/LosersAFC/blog/213251

你可能感兴趣的文章
ClickStat业务
查看>>
spring3.0.7中各个jar包的作用总结
查看>>
Windows 10 /win10 上使用GIT慢的问题,或者命令行反应慢的问题
查看>>
Windows平台分布式架构实践 - 负载均衡
查看>>
iOS自定制tabbar与系统的tabbar冲突,造成第一次点击各个item图片更换选中,第二次选中部分item图片不改变...
查看>>
我的路上
查看>>
Velocity处理多余空白和多余空白行问题
查看>>
DB2与oracle有什么区别
查看>>
创建一个多级文件目录
查看>>
Picasa生成图片幻灯片页面图文教程
查看>>
svn status 显示 ~xx
查看>>
常用HiveQL总结
查看>>
[转]使用Visual Studio Code开发Asp.Net Core WebApi学习笔记(三)-- Logger
查看>>
POJ 3311 Hie with the Pie(状压DP + Floyd)
查看>>
Security updates and resources
查看>>
DNS为什么通常都会设置为14.114.114.114
查看>>
Sqoop架构(四)
查看>>
golang copy函数
查看>>
《你有多少问题要请示》精华集粹
查看>>
打印图片
查看>>