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
: 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