CSS/Cookbook

【CSS/Cookbook】<fieldset>, <legend> (Group으로 묶어서 표시하기)

1Q74 2023. 5. 24. 16:01

1. Description

     <fieldset>는 Element들을 Group으로 묶고, <legend>로 그룹명을 넣는다.


2. Example

[1q74.tistory.com] css/fieldset
Div Boxes
box#1
box#2

3. Code

더보기
<!-- ---------------------------------------------------------
  --
  -- Author: 1q74.tistory.com
  --
  --------------------------------------------------------- -->

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>[1q74.tistory.com] css/fieldset</title>
<style>
fieldset#_1q74-example-container {
	border: solid 1px;
	border-style: dotted;
	padding: 10px;
}

div[name="_1q74-example-1"] {
	background: green;
	width: 100px;
	height: 100px;
	display: inline-block;
}

div[name="_1q74-example-2"] {
	background: lightgreen;
	width: 100px;
	height: 100px;
	display: inline-block;
}
</style>
</head>
<body>
	<fieldset id="_1q74-example-container">
		<legend>Div Boxes</legend>
		<div name="_1q74-example-1">
			box#1
		</div>
		<div name="_1q74-example-2">
			box#2
		</div>
	</fieldset>
</body>
</html>

4. File

[css][fieldset]example.html
0.00MB


5. See also

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset