Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS float 속성을 사용하여 요소 정렬

<시간/>

CSS에서 float 속성을 사용하여 요소를 정렬하려면 다음 코드를 실행할 수 있습니다. -

예시

<!DOCTYPE html>
<html>
   <head>
      <style>
         .demo {
            float: right;
            width: 200px;
            border: 1px dashed blue;
            padding: 5px;
         }
      </style>
   </head>
   <body>
      <h1>Heading</h1>
      <div class = "demo">
         <p>This is demo text and right aligned.</p>
      </div>
   </body>
</html>

출력

CSS float 속성을 사용하여 요소 정렬