Tài liệu Creating Class Styles

Thảo luận trong 'Thiết Kế Web' bắt đầu bởi Thúy Viết Bài, 5/12/13.

  1. Thúy Viết Bài

    Thành viên vàng

    Bài viết:
    198,891
    Được thích:
    173
    Điểm thành tích:
    0
    Xu:
    0Xu
    The CSS class works in a very similar way to the elements’
    style definition. You define the CSS class either in the style region
    within your HEAD element or in the CSS style document. The
    following
    is an example of a CSS class style.
    .mainTitleStyle {
    font-family: Cambria, Cochin, Georgia, Times,
    “Times New Roman”, serif;
    font-size: 30px;
    font-weight: bolder;
    color: #008000;
    }
    As you can see, the main structure for defining the class style
    is the same as an element. The difference is that the class is identified
    by a leading period and the class name is all one word. You
    cannot use spaces in your class name.
    After you have created your style you can apply it to any element
    in your web page. The element attribute class is used to
    associate the element with the CSS class. Here is an example.
    <p class=“mainTitleStyle”>Lorem Ipsum Header</p>
    <p>In vestibulum, ipsum consectetur cursus porttitor, mi
    tellus euismod purus, ac egestas nisl risus ac risus. </p>
    <p class=“mainTitleStyle”>Lorem ipsum dolor sit amet</p>
    <p>Aliquam sollicitudin elementum est, commodo gravida
    lorem imperdiet ac. </p>
    <p class=“mainTitleStyle”>consectetur adipiscing elit</p>
    <p >Lorem ipsum dolor sit amet</p>
     

    Các file đính kèm:

Đang tải...