tailieunhanh - Học JavaScript qua ví dụ part 66

Các Container Một trong những container quan trọng nhất là Nó phục vụ như một container khối cấp chung chung, nơi bạn có thể đặt các yếu tố khác và cho chúng màu sắc, biên giới, lợi nhuận, và vv. Đó là hữu ích nhất khi được sử dụng với CSS, cho phép bạn dễ dàng thay đổi các nội dung của div cho một toàn bộ trang web. Một trang web, ví dụ, thường được chia thành một tiêu đề, chuyển hướng. | Positioning Elements and Layers 579 Figure Blocks are absolutely positioned based on pixels from top bottom left and right. Figure Firefox Absolute positions with four blocks. Window height is changed and boxes overlap. The div Container One of the most important containers is the div It serves as a generic block-level container where you can put other elements and give them color borders margins and so forth. It is most useful when used with CSS allowing you to easily change the contents of the div for an entire site. A site for example is often divided up into a header navigation From the Library of 580 Chapter 14 Introduction to CSS Cascading Style Sheets with JavaScript bars content and a footer. Each of these sections could be placed in its own div container and all of those divs enclosed in one main div. CSS Class Declaration .bigblue border-style solid border-width 1px color blue font-family arial times serif font-size 32pt color blue The HTML div tags div class bigblue This is the text in a container. div Absolute Positioning The div container is not only used to change colors borders fonts and so on but it is used for absolute or relative positioning of a block of text. For example it allows you to create a paragraph style independent of the p tag. Within the block the span tags can be used to introduce other styles. In the following example the div tag is used to create a block. It is absolutely positioned in the window at position 0 0 which is the top left corner. Absolute positioning allows you to place an element anywhere on the page separate from the rest of the document. The top left corner of the document or the elements parent originate at coordinates 0 0. EXAMPLE html head title Positioning title 1 style 2 .divStyle background-color blue 3 position absolute width 250px height 150px p color white font-size 18pt position absolute left 10px height 5px style head body 4 div class divStyle 5 p From .

TỪ KHÓA LIÊN QUAN