Answers for "force float div to new line css"

CSS
0

force float div to new line css

/*
If you have an element like a div that is set to float left,
but you'd like it to appear on a new line alltogether 
then simply remove the "float:left" (replace with float:none) 
and add "display:inline-block"
*/

.classname {
	float:none
  	display:inline-block;
}

/*
If you'd like this to kick in when viewing on mobile only,
then simply use a "media query" like below: 
*/

@media only screen and (max-width:600px) {
	.classname {
		float:none;
  		display:inline-block;
	}
}

/* Happy coding, my homies <3 */
Posted by: Guest on March-11-2021

Browse Popular Code Answers by Language