For the last 10 years the question of whether to use fixed or liquid layouts when designing a website has raged on in the web design world, with major design players on both sides of the proverbial fence.
ÔÚ¹ýÈ¥µÄ10ÄêµÄ»¥ÁªÍøÉè¼ÆÁìÓòÖУ¬Ê¹Óӹ̶¨²¼¾Ö”»¹ÊÇʹÓÓ¸¡¶¯²¼¾Ö”ÊÇÒ»¸öÈËÃǾ³£ÕùÂ۵ϰÌ⣬˫·½¶¼¸÷Ö´Ò»´Ê¡£
Recently though, as screen resolutions have increased dramatically, fixed layouts have all but replaced liquid, but there are still come major advantages to a liquid layout if designed properly.
×î½ü£¬Ëæ×ÅÏÔʾÆ÷ѸËٵĸüл»´ú£¬ºÜ¶à“¹Ì¶¨²¼¾Ö”·½Ê½¿ªÊ¼±»“¸¡¶¯²¼¾Ö”·½Ê½ËùÈ¡´ú¡£Èç¹û“¸¡¶¯²¼¾Ö”Éè¼ÆµÄµÃÌåµÄ»°£¬ËüÈÔÈ»ÊÇÓкܶàÓŵãµÄ¡£
Preliminaries
ǰÑÔ
When I use the term "containing" elements, I'm referring to the columns or boxes that hold the text, images, and other content. Containing elements may have borders and background images, but are usually just the visual containers for the important content on the screen.
µ±ÎÒʹÓÓcontaining[ÈÝÆ÷]”ÔªËØÊ±£¬ÎÒÌáµ½ÁËʹÓÃÁкÍÎı¾¿òÀ´´æ·ÅÎı¾¡¢Í¼Æ¬ºÍÆäËûÄÚÈÝ¡£“ÈÝÆ÷ÔªËØ”¿ÉÒÔ°üº¬±ß¿òºÍ±³¾°Í¼Æ¬£¬µ«ÊÇ£¬Í¨³£Çé¿öÏ£¬ËüÒ»°ã¶¼ÊÇÓÃÀ´°üº¬ÖØÒªÄÚÈݵġ£
Fixed width layout
¹Ì¶¨¿í¶È²¼¾Ö
In a fixed layout, the size of each "containing" element on the webpage is specified exactly. The page will not change when you resize your browser window. It will essentially look the same on any browser or computer.
ÔÚ“¹Ì¶¨²¼¾Ö”ÖУ¬Ã¿¸ö“ÈÝÆ÷ÔªËØ”µÄ³ß´ç¶¼ÊÇÒ»¸ö¾«È·Öµ¡£µ±Äã¸Ä±äÄãµÄä¯ÀÀÆ÷´°¿Ú´óСʱ£¬Ò³ÃæµÄ³ß´ç²»»áËæÖ®·¢Éú±ä»¯¡£ËùÒÔ£¬²»¹ÜÄãÔÚÈκÎһ̨µçÄÔÉÏ»òÈκÎÒ»ÖÐä¯ÀÀÆ÷Éϲ鿴¸ÃÒ³Ãæ£¬¿´µ½µÄ³ß´ç´óС¶¼ÊÇÍêÈ«ÏàͬµÄ¡£
Liquid layout
“¸¡¶¯²¼¾Ö”
In a liquid layout, the size of the containing elements changes depending on the browser size and user preferences. The container size increases when viewed at larger screen resolutions and decreases when the browser is resized.
ʹÓÓ¸¡¶¯²¼¾Ö”Ê±Ã»Ò³ÃæµÄ³ß´ç´óС»áËæ×Åä¯ÀÀÆ÷µÄ³ß´ç´óСºÍÓû§ÊôÐÔµÄ¸Ä±ä¶ø¸Ä±ä¡£µ±Ê¹Óôó³ß´çÏÔʾÆ÷ʱ£¬Õû¸ö“Ò³ÃæÈÝÆ÷”µÄ³ß´ç»á·Å´ó£»µ±Ê¹ÓÃС³ß´çÏÔʾÆ÷ʱ£¬Õû¸ö“Ò³ÃæÈÝÆ÷”µÄ³ß´ç»áËõС¡£
Advantages and Disadvantages (pros and cons):
ÓŵãºÍȱµã£¨ÕýÃæÐԺ͸ºÃæÐÔ£©£º
Fixed width layout
¹Ì¶¨¿í¶È²¼¾Ö
Pros £¨ÕýÃæÐÔ£©
- Guarantees an easy to read line length
È·±£Ã¿ÐÐÄÚÈݵij¤¶È²»±ä£¬Ò×ÓÚÔĶÁ
- Allow images to be placed exactly in relation to other elements and type sizes
ÔÊÐíͼƬ¸ù¾ÝÆäËüÔªËØ»òÑùʽ³ß´ç·ÅÖÃÔÚÒ»¸ö¾«È·µÄλÖÃÉÏ
- Allows designer full control over how the page is displayed (as opposed to the user)
ÔÊÐíÉè¼ÆÊ¦¶ÔÒ³ÃæµÄÏÔʾ·½Ê½½øÐÐÍêÈ«µÄ¿ØÖÆ£¨Óû§Ôò²»ÐУ©
- Allows for predictable default printing behavior.
ÈÝÒ×ÕÆ¿ØÊä³öµÄ·½Ê½ºÍ·ç¸ñ
Cons £¨¸ºÃæÐÔ£©
- May create a type size that is not optimal
²»ÄÜÈ·±£ÓÀÔ¶´¦ÓÚ×î¼Ñ³ß´çÀàÐÍ
- Takes control over page size and text size away from the user.
Óû§²»ÄܶÔÒ³ÃæµÄ³ß´çºÍÎı¾µÄ³ß´ç½øÐпØÖÆ
- Doesn't take advantage of screen real estate and may produce large unused portions of window space that could potentially increase the amount of scrolling users have to do (this is especially true at higher resolutions)
²»Äܹ»³ä·ÖµÄÀûÓÃÏÔʾÆ÷ËùÓеĿռ䣬¿ÉÄÜ»áÔÚÏÔʾÆ÷ÉϳöÏÖÁô°×ÏÖÏ󣬴Ӷøµ¼ÖÂÓû§²»µÃ²»¹ö¶¯¹ö¶¯Ìõ²ÅÄÜä¯ÀÀËùÓеÄÄÚÈÝ£¨ÌرðÊÇÔڸ߷ֱæÂÊÏ£©¡£
Liquid layout:
“¸¡¶¯²¼¾Ö”
Pros £¨ÕýÃæÐÔ£©
- Allows for maximum use of space or screen real-estate. Also allows the most control over sizing by the user, because a user can resize the website to their preferences.
¿ÉÒÔ³ä·ÖµÄÀûÓÃÏÔʾÆ÷µÄËùÓпռ䣬Óû§¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄÐèÒª¶Ô³ß´çµÄ´óС½øÐпØÖÆ£»²¢ÇÒ£¬Óû§¿ÉÒÔ¸ù¾Ý×Ô¼ºÍ¨¹ýÉèÖòÎÊýÀ´¶ÔÍøÕ¾½øÐгߴçÉèÖÃ
- Allows text size to be changeable by user preferences, making it easy for people with vision problems to increase or decrease the text size on the page while the layout adjusts around the increased size automatically.
ÔÊÐíÓû§¸ù¾Ý×Ô¼ºÍ¨¹ýÉèÖòÎÊýÀ´¶ÔÍøÕ¾½øÐгߴçÉèÖá£Õâ¶Ô´æÔÚÊÓÁ¦ÕϰµÄÈËÀ´ËµÊÇÒ»¼þ·Ç³£ºÃµÄÊÂÇé¡£ËûÃÇ¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄÐèÒª¶ÔÎı¾´óС½øÐе÷Õû£¬Í¬Ê±£¬Õû¸öÒ³ÃæµÄ²¼¾ÖÒ²»áËæÖ®×Ô¶¯µ÷Õû¡£
- When designed correctly, it sets your website look slightly apart from competitors, considering most websites use a fixed layout.
Èç¹ûÉè¼ÆµÄ¿¼¾¿£¬ÄÇôÄãµÄÍøÕ¾Ïà¶ÔÓÚÄÇЩʹÓӹ̶¨²¼¾Ö”µÄ¾ºÕù¶ÔÊÖ¶øÑÔ»áÏԵ÷dz£µÃÌå¡£
Cons £¨¸ºÃæÐÔ£©
- If the screen-size becomes too large or too small it can produce unreadable text, or hard to read/scan line lengths
Èç¹ûÏÔʾ³ß´ç±äµÄÌ«´ó»òÊÇ̫С£¬ÄÇô£¬Õâ¿ÉÄܵ¼Ö²¿·ÖÎı¾ÎÞ·¨ÔĶÁ£¬»òÕß³öÏÖÒ»¸öºÜ²»Ðµ÷¡¢·Ç³£ÄÑÓÚä¯ÀÀµÄÐÐ¿í¡£
- Can cause problems with default page printing. (A separate print style sheet can be used allowing for perfect printing from any page despite a liquid layout, but if a separate style sheet for printing is not provided this con is valid)
Èç¹ûÊÇÊä³öĬÈÏÒ³Ãæ£¬ÄÇôҲ¿ÉÄܵ¼ÖÂÎÊÌ⣨¾¡¹ÜÔÚ“¸¡¶¯²¼¾Ö”Ï£¬Ê¹ÓöÀÁ¢µÄÊä³öÑùʽ±í¿ÉÒÔʹÿ¸öÒ³Ãæ¶¼ÏÔʾµÄÍêÃÀÎÞȱ£»µ«ÊÇ£¬Èç¹ûÔÚ²»Ö§³Ö¶ÀÁ¢Êä³öÑùʽ±íµÄÇé¿öÏ£¬ÄÇô¾Í»á³öÏÖÕâ¸öÎÊÌ⣩¡£
- As the website size changes, the image size to text proportion may create a less desirable look.
µ±ÍøÕ¾µÄ³ß´ç¸Ä±äʱ£¬Í¼Æ¬³ß´çºÍ²¿·ÖÎı¾³ß´ç¿ÉÄÜ»á³öÏÖ²»Ðµ÷µÄÇé¿ö¡£
Modern Screen Resolutions and the Prevalence of Fixed Width Layouts
¸ß¼¶ÏÔʾÆ÷·Ö±æÂʺÍÁ÷Ðеē¹Ì¶¨¿í¶È”²¼¾Ö
The problem facing layout design in modern web design is the huge variance of common screen resolutions among potential website visitors. The smallest acceptable and still common modern resolution is 800 pixels wide by 600 pixels tall. With the recent surge in wide-screen and large monitors resolutions, a screen width of 1280 pixels plus is also very common.
ÏÖ´úÍøÒ³Éè¼ÆÖУ¬ÕâÖÖ²¼¾ÖÃæÁÙµÄ×î´óÎÊÌâ¾ÍÊÇ£ºÇ±ÔÚµÄÍøÕ¾·ÃÎÊÕßËùʹÓõÄÏÔʾÆä·Ö±æÂÊÒѾ·¢ÉúÁ˾޴ó±ä»¯¡£Ð¡²¿·ÖÈËÈÔȻԸÒâʹÓÃ800pix*600pix£»µ«ÊǶÔÓÚʹÓôó³ß´çÏÔʾÆ÷µÄ·ÃÎÊÕßÀ´Ëµ£¬Ê¹ÓÃ1280ÏñËØ*1024ÏñËØµÄ·Ö±æÂÊÒ²·Ç³£ÆÕ±é¡£
Q. So how do you design a site that looks good with both a 800 pixel width and a 1280 pixel width?
ÎÊÌ⣺ÄãÓ¦¸ÃÔõÑùÉè¼ÆÒ»¸öÍøÕ¾Ê¹ÆäͬʱÔÚ800pixºÍ1280pixµÄ·Ö±æÂÊ϶¼ÄܾßÓкܺõÄÏÔʾЧ¹û£¿
Most web designers don't, they use a fixed layout that's 800 pixels wide and call it good. With that said, I have personally designed and have seen some beautiful layouts that look good and are readable at both those resolution extremes. The specific details of these layouts are beyond the scope of this article, but most of the designs I've seen or created that successfully accomplish this task use multiple content columns in combination with "padding" that is defined as a percentage of the screen. So when the screen is small, the multiple columns are very close together, but when the screen is large the padding increases proportionally and the columns are spaced further apart.
´ó¶àÊýÍøÕ¾Éè¼ÆÊ¦¶¼Ç×íùÓÚʹÓÃ800ÏñËØ¿í¶ÈµÄ²¼¾Ö¡£¶ÔÓÚÉÏÊöÕâÖÖ˵·¨£¬ÎÒÒ²ÓÐ×Ô¼ºµÄ¿´·¨¡£ÎÒ×Ô¼ºÒ²Éè¼Æ¹ý·Ç³£²»´íµÄ²¼¾Ö·½°¸£¬²¢ÇÒÒ²¿´µ½¹ýÐí¶à·Ç³£²»´íµÄ²¼¾Ö°¸Àý£¬ÕâЩ²¼¾Ö¶¼ÊÇ“¸¡¶¯²¼¾Ö”£¬²¢ÇÒÔÚÈκηֱæÂÊ϶¼¿ÉÒԺܺõÄÏÔʾ£»Èç¹û̸µ½ÕâÀ಼¾ÖµÄ¾ßÌåϸ½Ú²¿·Ö£¬Ö÷ÒªµÄÎÊÌ⻹ÊÇÎÄÕ³ߴçµÄÎÊÌâ¡£µ«ÊÇÎÒÒѾ³É¹¦µØ½â¾öÁËÕâЩÎÊÌ⣬¾ßÌå·½·¨¾ÍÊÇ£º½«ÄÚÈݶàÁÐÏÔʾ£¬²¢ÓÃÒÔ°Ù·Ö±ÈÀ´¶¨ÒåµÄ“padding”ÊôÐÔ¶ÔËü½øÐв¼¾Ö¿ØÖÆ¡£ËùÒÔ£¬µ±ÏÔʾÆ÷³ß´çºÜСʱ£¬ÕâЩÄÚÈÝÁÐÖ®¼äµÄ¿Õ϶¾Í»áÏà¶Ô½ÏС£¬±Ë´Ë½ô¿¿£»µ«Êǵ±ÏÔʾÆ÷³ß´ç±È½Ï´óʱ£¬ÕâЩÄÚÈÝÁÐÖ®¼äµÄ¿Õ϶¾Í»áͬ±ÈÀýÔö¼Ó£¬¿´ÉÏÈ¥¾Í»á¿íËÉÒ»µã¡£
Recommendations and Analysis
½¨ÒéºÍ·ÖÎö
Most websites should probably be designed with a fixed or "semi" fixed layout. It guarantees readability and perfect presentation of content. With that said, if your website contains a large amount of text based content (more then 3-5 paragraphs per page) or if the website would greatly benefit from a non-standard design scheme use liquid.
´ó¶àÊýÍøÕ¾¶¼Ó¦¸ÃʹÓӹ̶¨²¼¾Ö”»ò“°ë¹Ì¶¨²¼¾Ö”£¨¼´£º²¿·ÖÄÚÈݹ̶¨£¬²¿·ÖÄÚÈݸ¡¶¯£©¡£ÕâÑù¿ÉÒÔÈ·±£ÄÚÈݵĿɶÁÐÔ£¬²¢ÓÐÀûÓÚ°ÑËü·ÅÔÚÒ»¸öºÏÊʵÄλÖÃÉÏ¡£µ«ÊÇ£¬Èç¹ûÏñÉÏÃæËù˵µÄÄÇÑù£¬ÄãµÄÍøÕ¾°üº¬ºÜ¶àµÄÎÄÕ¶ÎÂ䣨È磺ÿҳ¶àÓÚ3-5¸ö¶ÎÂ䣩£¬»òÕߣ¬Èç¹ûÍøÕ¾¿ÉÒÔ´ÓÒ»¸ö·Ç±ê×¼µÄÉè¼Æ¼Æ»®ÖÐÊÜÒæ£¬ÄÇô¾ÍʹÓÓ¸¡¶¯²¼¾Ö”°É¡£
If you're still not sure, choose fixed. A fixed layout is easy to maintain, and assures readability by all users and is easier for a web designer to code perfectly. A poorly done liquid layout will cause more problems then it will fix and annoy potential users. For example, one of my personal pet peeves is when a designer uses a single column liquid layout. My personal computer workstation consists of two monitors a 19 inch, and a 17 inch wide screen. When a website is designed with a single liquid column the width of the page usually is way too wide for easy reading, so I have to manually adjust the window size.
Èç¹ûÄã¶ÔÉÏÃæËµµÄÕâÖÖÇé¿ö²»Äܹ»È·¶¨£¬ÄÇô»¹ÊÇÑ¡Ôñ“¹Ì¶¨²¼¾Ö”±È½ÏºÃ¡£“¹Ì¶¨²¼¾Ö”Ò×ÓÚά»¤£¬Äܹ»È·±£½ÏÇ¿µÄ¿É¶ÁÐÔ£¬Ò²¿ÉÒÔ°ïÖúÍøÂçÉè¼ÆÊ¦½øÐкܺõĴúÂë²¼¾Ö¡£“¸¡¶¯²¼¾Ö”µÄȱµã¾ÍÊÇ£¬Ëü¿ÉÄܺÜÄѶԲ¿·ÖÄÚÈݽøÐй̶¨£¬´Ó¶øµ¼ÖÂÓû§¿´ÆðÀ´·Ç³£±ðŤ¡£¾Ù¸öÀý×ÓÀ´Ëµ£¬ÎÒµÄÒ»¸öºÃÓѷdz£²»Ô¸Òâ¿´µ½µÄÒ»ÖÖ²¼¾Ö·½Ê½¾ÍÊÇ£ºÉè¼ÆÊ¦½öʹÓÃÒ»ÁÐÄÚÈÝ£¬²¢ÓÓ¸¡¶¯²¼¾Ö”·½Ê½¶ÔÆä½øÐв¼¾Ö¡£¾ÍÎÒ¸öÈ˶øÑÔ£¬ÎÒ×¼±¸ÁËÁ½Ì¨ÏÔʾÆ÷£¬Ò»Ì¨ÊÇ19´ç£¬Ò»Ì¨ÊÇ17´ç¡£µ±ÍøÕ¾Ê¹ÓÓ¸¡¶¯²¼¾Ö”·½Ê½²¼¾Öʱ£¬Í¨³£ÐèÒª°ÑÒ³ÃæÈ«²¿Õ¹¿ª²ÅÄܱ£Ö¤Ò»¸ö½ÏºÃµÄä¯ÀÀЧ¹û£¬Òò´Ë£¬ÎҾͲ»µÃ²»ÊÖ¶¯µ÷Õû´°¿Ú³ß´ç´óС¡£