HOW TO DESIGN AND WRITE WEB PAGES TODAY phần 9

Ý kiến XHTML không trả lại trên trang của bạn trong trình duyệt, cũng không phải là trình duyệt bị ảnh hưởng bởi nội dung của họ. (Tuy nhiên, nó thực sự là hai dấu gạch nối, -, mà đóng, do đó, không sử dụng một dấu nối đôi | 242 HOW TO DESIGN AND WRITE WEB PAGES TODAY CSS div page width 700px Just below that style one could write a widescreen style using the widescreen class as a hook CSS div page width 1000px Depending on how the rest of the page is designed in CSS that simple addition may be enough to improve the site s appearance. In the case of the example from Chapter 17 the style declaration on the descendant selector with the widescreen hook is indeed all it takes to change the design see Figure . There is one problem however in its current form the rpkwidescreen function is run only once when the page is loaded. Suppose someone changes the size of his browser window while looking at the site either using the maximize button or dragging the corner of the browser window to make it larger or smaller. Either way the window size has changed perhaps to a wide screen size perhaps to Figure . Using the widescreen class that a bit of DOM Scripting adds to the body the layout can be adjusted in the CSS to suit larger screens. PERFORMANCE AND INTERACTION 243 a small screen size. To account for changes in the browser window size an additional line of JavaScript would be necessary JavaScript inside the ready event rpkwidescreen Check the window size when the DOM is ready window .resize rpkwidescreen Check again whenever the window is resized Using another event resize the rpkwidescreen function will run every time the browser window changes size. Resizes that are greater than 1100 pixels wide will result in the widescreen class being added to body or being left on if it already was added . If the window is less than 1100 pixels wide the widescreen class will be removed if it had been added previously. The browser should automatically redraw the layout if there is a change in size class using the appropriate instructions in the CSS. DOM SCRIPTING FOR PAGE CONTENT EXTERNAL LINKS Suppose you wanted to use CSS to style contextual links differently when they point to .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.