Responsive layouts and their utility classes

Source: Internet
Author: User

The so-called responsive layout, is based on the size of the view of the different, make corresponding changes

The principle is to use CSS3 media queries to determine the size of the browser window

1 <!DOCTYPE HTML>2 <HTMLLang= "en">3 <Head>4     <MetaCharSet= "UTF-8">5     <title>Media Queries</title>6     <Linktype= "Text/css"rel= "stylesheet"href=".. /.. /resources/bootstrap-2/css/bootstrap.css ">7     <Scripttype= "Text/javascript"src=".. /.. /resources/bootstrap-2/js/bootstrap.js "></Script>8     <Scripttype= "Text/javascript"src=".. /.. /resources/jquery/jquery-1.12.4.min.js "></Script>9 Ten  One     <Scripttype= "Text/javascript"src=".. /.. /resources/js/html5.js "></Script> A     <!--troubleshoot display problems on your phone - -     <Metaname= "Viewport"content= "Width=device-width, initial-scale=1.0"> -     <!--troubleshoot low version of IE - the     <!--[If Lt ie9]> - <script type= "Text/javascript" src= ". /.. /resources/js/html5.js "></script> - <! [EndIf] - -     <style> + Body{ - background:#000000; +         } A         /*Reset the style when the browser window is less than 767 pixels wide*/ at @media (max-width:767px){ - body{ - background:#f00000; -             } -         } -     </style> in </Head> - <Body> to  + </Body> - </HTML>
A simple example of responsive layout

The above uses the Max-width, which is triggered when the window is less than the specified value, and can also use Min-width, which indicates that it is triggered when the specified value is greater than

can also be used in combination, (MAX-WIDTH:V1) and (MIN-WIDTH:V2), indicating that the style is triggered when within this interval

How do you change a fixed-style layout to a responsive layout?

Only need to add

<type= "Text/css"  rel= "stylesheet"  href= ". /.. /resources/bootstrap-2/css/bootstrap-responsive.css ">

Bootstrap has been pre-defined to handle the size of the common browse window

    • Practical class

: Visible-phone shows the element on the phone, other places hidden

: Visible-tablet Displays the element on the tablet and hides it elsewhere

: Visible-desktop Displays the element on the computer and hides it elsewhere

: Hidden-phone hides the element on the phone, and the element is displayed elsewhere

: Hidden-tablet hides the element on the tablet, and the element is displayed elsewhere

: Hidden-desktop hides the element on the computer and displays it elsewhere

Responsive layouts and their utility classes

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.