`
Virgo_S
  • 浏览: 1138482 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

2、CSS Selectors,Properties,and Values

    博客分类:
  • CSS
阅读更多
HTML有标签,CSS有选择器。选择器是给内部和外部样式里面的样式命名。
  每个选择器都有属性在{}里面,比如简单点像color,font-weight或background-color。
  值在冒号(不是等号)后面,分号分离属性。
body {
    font-size: 0.8em;
    color: navy;
}

上面的意思是为body选择器设置font-size字体大小和color字体颜色。

  所以基本的,当它作用与HTML页面时,在body标签(整个窗口中的内容)之间的文字颜色是navy字体大小是0.8ems。
长度和百分比

  CSS里面有许多属性值要指定单位,但有些基本单位被使用在一些属性上,在这之前值得属性下它们。
  em比如font-size:2em给于字体计算出的大小,所以2em就是实际字体大小的两倍。
  px比如font-size:12px是pixel像素的单位。
  pt比如font-size:12px是points镑的单位。
  %比如font-size:80%是百分比
  其他单位包括pc(12点西文活字)、cm(厘米)、mm(毫米)和in(英寸)

  当值是零的时候,不需要单位,例如:border:0意思没有边框。

  网页不是静态的、绝对的媒体。这意味着内能伸缩变形,用户应该被允许调整自己喜欢的方式,包括字体大小和屏幕大小。

  因为这样,建议使用"em"和"%"在font-size上(宽度和高度),相比下px不能够在大部分浏览器改变大小,所以要少用,可以用在边框的大小上。
分享到:
评论

相关推荐

    CSS Quick Syntax Reference

    How to work with CSS values like keywords, color and number values, percentage values, length values, and strings How to apply CSS selectors: structural pseudo-classes, the negation pseudo-class, ...

    Learn CSS in One Day and Learn It Well (Volume 2)

    Each CSS chapter comes with an end-of-chapter exercise where you get to practice the different CSS properties covered in the chapter and see first hand how different CSS values affect the design of ...

    CSS The Definitive Guide 4th Edition 2017年出版1088页

    Values, units, fonts, and text properties Padding, borders, outlines, and margins Colors, backgrounds, and gradients Floats and positioning tricks Flexible box layout The new Grid layout system 2D and...

    Beginning CSS3 (pdf)

    CSS3 is the latest version of Cascading Style ... CSS3 Image Values and Replaced Content (gradients) CSS Multi-column Layout CSS Transforms CSS Transitions CSS Animations CSS Flexible Box Layout

    CSS Pocket Reference, 5th Edition--2018

    Explore CSS concepts, values, selectors and queries, and properties Learn how new features complement and extend your CSS practices Discover new properties including animations, grid, flexbox, ...

    stylecssvaribles1.css

    It searches for all rules containing variable getters and setter, remembers the affected selectors so future affected Elements can be found in a mutation observer. Each affected Element gets a uniq ...

    WordPress 2.9 E-Commerce.pdf

    CSS properties and values 175 Changing the header image 177 Replacing the theme fonts 179 Changing the theme colors 181 Additional CSS tutorials 182 Additional WP e-Commerce themes 182 WP e-...

    javascript权威指南(第六版)

    19.8 jQuery Selectors and Selection Methods 574 19.9 Extending jQuery with Plug-ins 582 19.10 The jQuery UI Library 585 20. Client-Side Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

    Sortable前端框架

    filter: ".ignore-elements", // Selectors that do not lead to dragging (String or Function) preventOnFilter: true, // Call `event.preventDefault()` when triggered `filter` draggable: ".item", // ...

    jQuery完全实例.rar

    参考 Selectors 获取更多用于 expression 参数的 CSS 语法的信息。 -------------------------------------------------------------------------------- This function accepts a string containing a CSS ...

Global site tag (gtag.js) - Google Analytics