codingtcher.com
Theme Night
Home
Login

Css Float

Home » Css » Css Float

css float right

/*
	Puts your div on the right side of the screen
*/

.div-1{
  float: right;
  width: 50%;
  background-color: #f00;
}

Float element should have parent element that defined clear property.

<div class="clearfix">
    <div style="float: left;">Div 1</div>
    <div style="float: left;">Div 2</div>
</div>

.clearfix::after { 
   content: " ";
   display: block; 
   height: 0; 
   clear: both;
}
Source: stackoverflow.com

CSS Floats

img { 
	float: right;
	margin: 10px;
}

css float

/* Keyword values */
float: left;
float: right;
float: none;
float: inline-start;
float: inline-end;

/* Global values */
float: inherit;
float: initial;
float: revert;
float: revert-layer;
float: unset;
Source: developer.mozilla.org

Css Related Post