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

HTML 들여쓰기

text-indent 속성으로 알려진 HTML 인라인 스타일 속성은 논문을 작성할 때 단락의 첫 줄을 들여쓰는 것처럼 텍스트의 각 단락을 들여씁니다.

코드 편집기는 픽셀(px) 단위로 텍스트 들여쓰기를 만드는 방법을 보여줍니다.

<!DOCTYPE html>
<html lang="en">
   <head>
       <meta charset="UTF-8" />
       <meta name="viewport" content="width=device-width, initial-scale=1.0" />
       <title>Text Indent HTML</title>
   </head>
<body>
       <p style="text-indent: 25px;">
           Baseball ipsum dolor sit amet passed ball outs, sweep stretch bleeder triple play. Left fielder count fair swing cork balk ball. Full count southpaw reliever lineup crooked number fastball second base. Perfect game outfielder rally force dodgers right fielder dead ball era right field. Pickoff world series peanuts batting average cup of coffee foul inside robbed. Bleeder club appeal first base sidearm mustard steal line drive inning.
       </p>
         
          
       <p style="text-indent: 25px;">
           Sidearm bullpen base on balls national pastime losses reliever umpire pull dribbler. Manager 4-bagger tag national pastime pennant good eye relief pitcher. Save on-base percentage fan ejection baseball card skipper reliever strikeout bench. On-base percentage fenway contact win warning track, ball rhubarb center field. Starting pitcher hey batter out cellar cardinals basehit double switch. Play hey batter tigers sidearm in the hole shortstop no decision.
 
       </p>
       <p style="text-indent: 25px;">
 
           Off-speed petey pinch hitter astroturf walk off no decision count full count wrigley. Hack cheese helmet tossed gap run red sox. Fall classic in the hole ejection rotation rally center field shift. Manager pickoff knuckleball assist pinch runner pitchout stretch. Steal hardball extra innings alley rubber off-speed flyout third base. Baseline butcher boy umpire left field hitter, catcher win right field can of corn.
          
       </p>
   </body>

이 예는 픽셀(px)이라는 절대 길이 단위를 보여줍니다. . em과 같이 상대적/반응형 길이 단위로 들여쓰기를 표현할 수도 있습니다. , , 다음 % 전체 요소/단락의 너비.

이 속성은 같은 이름의 CSS 속성과 동일합니다. 이것과 CSS 버전의 유일한 차이점은 선택기 규칙이 있는 위치입니다. CSS 텍스트 들여쓰기 속성은 HTML 헤드 또는 CSS 외부 스타일시트의 스타일 태그에 있는 다른 CSS 규칙과 함께 있습니다. 이에 상응하는 HTML은 실제 마크업에서 인라인 스타일로 작성됩니다.