Home  >  Article  >  Web Front-end  >  Can the width and height of html inline tags be set?

Can the width and height of html inline tags be set?

青灯夜游
青灯夜游Original
2021-06-21 11:54:155400browse

htmlInline tags cannot be set in width and height, and setting the width and height attribute values ​​​​on them will not take effect. The width and height are completely dependent on the content. The height, line height, margins and padding of inline labels cannot be changed; the width is the width of its content (text or image) and cannot be changed.

Can the width and height of html inline tags be set?

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

In HTML, tags can be divided into block-level element tags and inline element tags.

What are block-level elements?

  • Always start on a new line;

  • Height, line height, and margins and padding can all be controlled;

  • The width defaults to 100% of its container unless a width is specified.

  • It can hold inline elements and other block elements

What are inline elements (inline elements)?

  • and other elements are on the same line;

  • Height, line height, margins and padding cannot be changed;

  • The width is the width of its text or image and cannot be changed

  • Inline elements can only accommodate text or other inline elements

Convert inline elements to block-level elements to set width and height

Generally, inline elements cannot directly set width and height. Has physical properties, which is why it does not occupy a row.

But we can convert it into a block-level element or an inline block element by setting the display:block; or display:inline-block; style, and then set Width Height.

For more programming related knowledge, please visit: Programming Video! !

The above is the detailed content of Can the width and height of html inline tags be set?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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