How to use css max-height attribute

(*-*)浩
Release: 2019-05-28 16:23:20
Original
2686 people have browsed it

The max-height attribute sets the maximum height of the element.

How to use css max-height attribute

Description

This attribute value will set a maximum limit on the height of the element. Therefore, the element can be shorter than the specified value, but not taller. Negative values ​​are not allowed.

Note: The max-height attribute does not include margins, borders, and padding.

Value Description
none
Default. The definition places no limit on the maximum height allowed for an element.
length
Define the maximum height value of the element.
%
Defines the maximum height as a percentage of the block-level object that contains it.
inherit
Specifies that the value of the max-height attribute should be inherited from the parent element.​

Example:

<html>
	<head>
	<style type="text/css">
		p
		{
			max-height: 10px
		}
	</style>
	</head>
	<body>

	<p>这是一些文本。这是一些文本。这是一些文本。
	这是一些文本。这是一些文本。这是一些文本。
	这是一些文本。这是一些文本。这是一些文本。
	这是一些文本。这是一些文本。这是一些文本。
	这是一些文本。这是一些文本。这是一些文本。</p>


	</body>
</html>
Copy after login

The above is the detailed content of How to use css max-height attribute. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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