"."/> ".">

Home  >  Article  >  Web Front-end  >  How to set the input width to be adaptive in html

How to set the input width to be adaptive in html

青灯夜游
青灯夜游Original
2021-12-10 16:20:555837browse

In HTML, you can use the width attribute and the "%" length unit to define a percentage width for the input element based on the width of the containing block (parent element), and then set the width of the input to be adaptive; the syntax "".

How to set the input width to be adaptive in html

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

In html, you can use the width attribute and the "%" length unit to set the width adaptation of the input.

When the width attribute uses the "%" length unit, you can define a percentage width based on the width of the containing block (parent element).

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
	</head>

	<body>
		<input /><br><br>
		<input style="width: 100%;" />
	</body>
</html>

How to set the input width to be adaptive in html

Recommended tutorial: "html video tutorial"

The above is the detailed content of How to set the input width to be adaptive in html. 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