TAILIEUCHUNG - Xây dựng ứng dụng cho Android với HTML, CSS và javascript - part 7

Tham khảo tài liệu 'xây dựng ứng dụng cho android với html, css và javascript - part 7', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Handling Long Titles Suppose we had a page on our site with a title too long to fit in the header bar Figure 3-4 . We could just let the text break onto more than one line but that would not be very attractive. Instead we can update the header hl styles such that long text will be truncated with a trailing ellipsis see Figure 3-5 and Example 3-7 . This might be my favorite little-known CSS trick. Example 3-7. Adding an ellipsis to text that is too long for its container header hl color 222 font-size 20px font-weight bold margin 0 auto padding l0px 0 text-align center text-shadow 0px lpx lpx fff max-width 160px overflow hidden white-space nowrap text-overflow ellipsis Figure 3-4. Text wrapping in the toolbar is not very attractive. Simple Bells and Whistles 43 Download from Figure 3-5. .but we can beautify it with a CSS ellipsis Here s the rundown max-width 160px instructs the browser not to allow the hl element to grow wider than 160px. Then overflow hidden instructs the browser to chop off any content that extends outside the element borders. Next white-space nowrap prevents the browser from breaking the line into two. Without this line the hl would just get taller to accommodate the text at the defined width. Finally text-overflow ellip sis appends three dots to the end of any chopped-off text to indicate to the user that she is not seeing the entire string. Automatic Scroll-to-Top Let s say you have a page that is longer than the viewable area on the phone. The user visits the page scrolls down to the bottom and clicks on a link to an even longer page. In this case the new page will show up prescrolled instead of at the top as you d expect. Technically this makes sense because we are not actually leaving the current scrolled page but it s certainly a confusing situation for the user. To rectify the situation we can add a scrollTo command to the loadPage function Example 3-8 . 44 Chapter 3 Advanced Styling Download from Whenever a

TỪ KHÓA LIÊN QUAN
Đã 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.