force float div to new line css

Solutions on MaxInterview for force float div to new line css by the best coders in the world

showing results for - "force float div to new line css"
Loane
04 Apr 2020
1/*
2If you have an element like a div that is set to float left,
3but you'd like it to appear on a new line alltogether 
4then simply remove the "float:left" (replace with float:none) 
5and add "display:inline-block"
6*/
7
8.classname {
9	float:none
10  	display:inline-block;
11}
12
13/*
14If you'd like this to kick in when viewing on mobile only,
15then simply use a "media query" like below: 
16*/
17
18@media only screen and (max-width:600px) {
19	.classname {
20		float:none;
21  		display:inline-block;
22	}
23}
24
25/* Happy coding, my homies <3 */