How to convert dt into block-level elements in HTML

醉折花枝作酒筹
Release: 2021-06-03 17:08:07
Original
2611 people have browsed it

Methods to convert dt into block-level elements: 1. Use the display attribute, the syntax "display:block"; 2. Use the float attribute, the syntax "float:left"; 3. Use the position attribute, the syntax " position:absolute|fixed".

How to convert dt into block-level elements in HTML

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

The following summarizes three methods for converting inline elements to block-level elements:

(1)display

(2)float

(3)position (Absolute and fixed)

Talk less and do more, run the following code to see the effect:

<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>行内元素转为块级元素</title>
    <style type="text/css">
      * {
        margin: 0;
        padding: 0;
        font-size: 20px;
        color: red;
      }
      div {
        margin-top: 20px;
      }
      a {
        display: block;
      }
      span {
        float: left;
      }
      i {
        position: absolute;
      }
    </style>
  </head>
  <body>
    <div>方法一:使用display</div>
    <dt>dt标签转为块级元素</dt>
    <div>方法二:使用float</div>
    <dt>dt标签转为块级元素</dt>
    <div>方法三:使用position(absolute和fixed)</div>
    <dt>dt标签转为块级元素</dt>
  </body>
</html>
Copy after login

Check whether the element is converted to a block-level element by inspecting it:

How to convert dt into block-level elements in HTML

Recommended learning: html video tutorial

The above is the detailed content of How to convert dt into block-level elements in HTML. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template