Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have two divs

| | 1 | 2 | |

style-->
CSS
float:left;width:100%


When I reduce the screen resolution it will like this

| | 1 | |
| | 2 | |

How to make this into

| | 2 | |
| | 1 | |
Posted
Updated 12-Nov-14 17:34pm
v2

Refer below code and use it. it is 100% working........


<style>
.div_1
{
	float: left;
	min-width: 350px;
	width: 50%;
}
.div_2
{
	float: right;
	min-width: 350px;
	width: 50%;
}

@media screen and (max-width: 800px) {
	.div_2
	{
		float: none;
		min-width: 350px;
		width: 100%;
	}
}
</style>
<div class="div_2">div 2</div>
<div class="div_1">div 1</div>
 
Share this answer
 
v3
Comments
MAGuru 18-Nov-14 1:10am    
| | 1 | |
| | 2 | |

this is the result
MAGuru 18-Nov-14 1:10am    
i need it like this

| | 2 | |
| | 1 | |
Mehul v Patel 19-Nov-14 2:04am    
i think you need to use media query. i have improve my solution check that.
Hi,

i don't know if you are applying design optimization to an existing website or you are developing a new one

but if you are developing a new one i would strongly suggest using BOOTSTRAP instead of reinventing the whole think yourself.

unfortunately i will not post a link as this is might be considered as spam.

Regards.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900