利用Dreamweaver CS5.5設計行動裝置網頁

智慧型手機竄紅、平板電腦普及、行動網路發達,讓上網不再是只需要宅在家裡才能做到的事情,不管是走路、等車、坐車、吃飯、蹲馬桶以及許多的時候,都可以利用這些裝置來進入網際網路的花花世界,所以許多的網站也針對這些行動裝置來製作獨立的頁面,甚至根據螢幕尺寸來最佳化頁面。

iPhone 臉書網站直式
iPhone 臉書網站橫式

上面這兩張圖,就是Facebook為了行動裝置而製作的頁面,左邊是iPhone直拿觀賞,右手邊則是橫拿,可以看到在左邊最上排只看到「個人檔案、訊息、更多」,右邊可看到「個人檔案、訊息、朋友、相片、更多」,橫拿比直拿多出了兩個選項,雖然只是小地方,但設計就是要掌握每一個細節,那我們該如何設計這樣的網頁呢?就讓我們慢慢來體驗吧!

很久很久以前在製作網頁的時候,我們可以在同一個頁面使用不同媒體的CSS樣式表來控制顯示內容,例如:

<link href="css/screen.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/handheld.css" rel="stylesheet" type="text/css" media="handheld" />
<link href="css/print.css" rel="stylesheet" type="text/css" media="print" />

上面的第一行是代表螢幕樣式、第二行為行動裝置樣式、第三行為列印樣式,不過目前有關行動裝置樣式已經因為時代的演進與科技的發達,已經瀕臨淘汰的邊緣了,現在我們製作行動裝置樣式,主要是靠裝置的螢幕寬度來決定不同的樣式表。

在Dreamweaver CS5.5中除了提供多螢幕預覽的模式之外:

Dreamweaver CS5.5 多螢幕預覽
Dreamweaver CS5.5 多螢幕預覽介面

還可以針對不同的螢幕尺寸來設定該使用哪個CSS樣式表檔,只要按下多螢幕預覽上方的媒體查詢按鈕。

Dreamweaver CS5.5 媒體查詢

上面的範例是針對螢幕寬度小於320像素的裝置使用phone.css,螢幕尺寸介於321像素~768像素之間的裝置使用tablet.css,加入了這樣的設定後在頁面內會多出兩段CSS的連結語法:

<link href="css/phone.css" rel="stylesheet" type="text/css" media="only screen and (max-width:320px)" />
<link href="css/tablet.css" rel="stylesheet" type="text/css" media="only screen and (min-width:321px) and (max-width:768px)" />

當然要看你在這兩個CSS中如何設定呈現頁面樣式囉!我的範例是在phone.css裡面將景點圖片的display設為none,另外要注意在<head></head>區段中要加入以下的語法:

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">

否則在手機橫向後頁面將會被放大,這樣我們的樣式表就會失效,瀏覽的效果可以參考下面的影片:

可以看到在320像素以下景點圖片會被隱藏,而超過這個大小圖片就會自動顯示,大家也可以自行用行動裝置瀏覽這個網址,也準備這個範例的原始檔讓大家下載研究。

You may also like...

6,174 Responses

  1. Ремонт телефонов表示:

    Профессиональный сервисный центр ремонт телефонов в москве ремонт мобильных телефонов

  2. Профессиональный сервисный центр по ремонту электросамокатов в Москве.
    Мы предлагаем: сколько стоит ремонт электросамоката
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  3. Buncombe, Andrew (19 September 2011).

  4. Профессиональный сервисный центр по ремонту электросамокатов в Москве.
    Мы предлагаем: починить электросамокат в москве
    Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!

  5. The late L. Sprague de Camp was one of the funniest males ever to write science fiction, however he had no sense of humor; or at least as odd a sense of humor as anyone you will ever meet.

  6. While the AR-15 type of rifle is easily the most likely sort of rifle to be obtained and deployed for home protection, there are others.

  7. Repeated design themes embody tantalizing peepholes into areas you’ll visit later, effectively-chosen close to-symmetry, mazes (oh, are there mazes!) and sometimes a central room connecting subareas of the extent, generally with three keyed doors.

  8. Great post! We are linking to this particularly great content on our website. Keep up the good writing.

  9. Better to study what it could possibly (or can’t) do long earlier than that happens.

  10. Тут делают продвижение продвижение сайта медицинского центра разработка сайтов медицинских организаций

  11. Whereas this could appear like a low-funding business in Rajasthan, the preliminary cost of photography tools – DSLRs, drones, filters, and so on., makes it a mid-scale investment.

  12. Here, you are properly regarded after, from the sprig of frivolously-scented lavender at your seat that sets the serene spirit here from the outset to the far-flung flavours of the menu, the place European dishes are served with contemporary British touches, utilizing solely one of the best seasonal substances and complemented by an informal, sharing-plates philosophy.

  13. Users with astigmatism will want corrective glasses or contact lenses to resolve that blurriness or irregularity, creating another disadvantage, albeit only for these with astigmatism.

  14. Kind L also can be utilized exterior the home the place it will be immediately uncovered.

  15. I used a boresighter as effectively, so I did not put any more cash downrange than I wanted to.

  16. You’ll find tons of stunning pieces from small artists on-line.

  17. In comparison, common blood lead in youngsters from uncontaminated comparable city areas is round two microgram/dL.

  18. Sadly presently we are unable to process exchanges.

  19. The Tithe Acts of 1936 and 1951 established the compulsory redemption of English tithes by the state the place the annual amounts payable were less than £1, so abolishing the bureaucracy and costs of gathering small sums of money.

  20. The trendy, the informal, and the contemporary are strictly off-limits in so conventional a space.

  21. 21. Gerkowicz A, Chyl-Surdacka K, Krasowska D, Chodorowska G. Function of vitamin D in hair loss: A short overview Int J Mol Sci.

  22. It then reverts to a decrease sacrificial current, while dangerous detrimental chloride ions migrate away from the steel and towards the positive anode.

  23. Therefore, there are various check and measurement methods to prove absolutely purposeful cables or to detect defective ones.

  24. These are truly one of the best jackets that an individual can have and a true jacket lover all the time want to have one of these of the very best quality due to the explanation that without it a jacket lover will not be complete.

  25. Log grabbers – These long steel tongs make it easier to carry out hearth administration duties once things begin getting hot.

  26. Massive flowers are daring and prominent.

  27. Тут делают продвижение создание медицинских сайтов под ключ разработка сайта медицинской клиники

  28. Тут делают продвижение создание сайтов для клиники разработка сайт медицинской клиники

  29. Ремонт телефонов表示:

    Профессиональный сервисный центр ремонт телефонов москва рядом ремонт мобильных телефонов

  30. Ремонт телефонов表示:

    Профессиональный сервисный центр профессиональный ремонт телефонов где можно починить телефон

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。