Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Responsive web design scenario

I am designing a 3 column web page layout like below.

3 column responsive web page layout

To make it responsive I specified widths in %, min width in pixels and float:left. Now If I resize the page, all 3 DIVs (1,2, and 3) get resized first then 3rd DIV moves below of 1st DIV. If I resize more then 2nd DIV moves to below of 1st and 3rd moves below to 2nd.

This is because of float property. But I want to modify it in such a way that 3rd DIV should be moved first (as it is already being) then 1st DIV should be moved instead of 2nd DIV. 2nd DIV must be on the top.

How can I do this?

like image 749
Amit Kumar Gupta Avatar asked Jun 29 '13 16:06

Amit Kumar Gupta


People also ask

What is responsive web design example?

Rally Interactive. Rally Interactive is an example of a responsive website that attempts to provide the user with the ultimate seamless experience between the mobile and desktop versions of their website. The hamburger menu is the exact same on the desktop version as it is on mobile.

What is responsive design for web design?

Responsive web design (RWD) is a web development approach that creates dynamic changes to the appearance of a website, depending on the screen size and orientation of the device being used to view it.

What are the 3 basic things required for responsive web design?

The Three Major Principles of Responsive DesignFluid Grid Systems. Fluid Image Use. Media Queries.


1 Answers

Reordering can be done with Flexbox. You will, however need 1 media query.

http://codepen.io/cimmanon/pen/fwqed

body {
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-flow: row wrap;
  -ms-flex-flow: row wrap;
  flex-flow: row wrap;
}

div {
  -webkit-flex: 1 1 20em;
  -ms-flex: 1 1 20em;
  flex: 1 1 20em;
}

@media (max-width: 40em) {
  .a, .c {
    -ms-flex-order: 1;
    -webkit-order: 1;
    order: 1;
  }
}
.a {
  background: orange;
}

.b {
  background: yellow;
}

.c {
  background: grey;
}

Reordering can also be done with relative positioning (see: https://stackoverflow.com/questions/16307621/reordering-elements-at-specific-browser-widths).

like image 142
cimmanon Avatar answered Sep 18 '22 21:09

cimmanon