Share Table-cell The realization method of the layout of the left fixed width and left and right fixed width

Source: Internet
Author: User
The following small series for you to share Table-cell completion of the left fixed width of the right fixed width and width and so on the layout of the implementation method. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.

Use Table-cell to complete the following layouts (IE8 and above)

1. Left Fixed width-right adaptive

    1. . left{               width:300px;               height:500px;               BORDER:1PX solid;               Float:left;         }   . right{               width:10000px;               height:500px;               Display:table-cell;               border:1px solid;         }       </style><p class= "left" ></p><p class= "right" >lorem ipsum dolor sit amet, consectetur Adipisicing elit. Beatae dolore est et itaque nesciunt nobis officia omnis optio similique vitae. Cupiditate eum exercitationem harum ID iusto maiores quaerat reprehenderit Sint.   </p>



The effect is as follows:

(Resize the window to test whether the right side changes depending on the window size)

2. Right fixed width-left adaptive

    1. <style>        . right{               width:200px;               height:500px;               BORDER:1PX solid;               Display:table-cell;           }           . left{               height:500px;               BORDER:1PX solid;               Display:table-cell;           }           . parent{               display:table;               table-layout:fixed;               width:100%;           }   </style><p class= "Parent" >    <p class= "left" >            Lorem ipsum dolor sit amet, consectetur Adipisicing elit.  Amet Aperiam, Assumenda Dolores Eaque, Fugiat Illo, in Inventore itaque Magni nemo nisi nulla obcaecati quaerat totam unde Voluptatem Voluptatum. Amet, Totam.       </p>    <p class= "right" ></p></p>



The effect is as follows:

And the left side of the fixed width slightly different, although only a fixed width of the position to change, but can not directly use the floating like the left width of the way to complete.

3, about fixed width-intermediate adaptive


xml/html Code copy content to clipboard


<style>       . parent{              display:table;              table-layout:fixed;              width:100%;          }           p{               border:1px solid;           }           . left,.right,.center{               Display:table-cell;           }           . left{               width:100px;               height:200px;           }           . right{               width:100px;               height:200px;           }   </style> <p class= "parent" >      <p class= "left" ></p>        <p class= "center" >       Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias amet delectus ducimus ea Eos eum, Libero Modi quia, Soluta temporibus unde,    ut. Aliquam, Dolorem ipsam porro quae           quisquam saepe vitae! </p>      <p class= "right" ></p></p>

The effect is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.