আমরা কেবলমাত্র উপাদানের বিষয়বস্তুর জন্য উচ্চতা এবং প্রস্থ নির্ধারণ করতে পারি, যদিও এই বৈশিষ্ট্যগুলিতে মার্জিন, প্যাডিং বা সীমানা অন্তর্ভুক্ত নয়৷
সিনট্যাক্স
CSS উচ্চতা সম্পত্তির সিনট্যাক্স নিম্নরূপ -
Selector {
height: /*value*/
} CSS প্রস্থ সম্পত্তির সিনট্যাক্স নিম্নরূপ -
Selector {
width: /*value*/
} আসুন প্রস্থ এবং উচ্চতার বৈশিষ্ট্যগুলির একটি উদাহরণ দেখি -
উদাহরণ
<!DOCTYPE html>
<html>
<head>
<title>CSS height and width</title>
</head>
<style>
* {
padding: 2px;
margin:5px;
}
button {
border-radius: 10px;
}
#containerDiv {
width:70%;
margin: 0 auto;
padding:20px;
background-image: linear-gradient(62deg, #fbab7e 0%, #f7ce68 100%);
text-align: center;
border-radius: 10px;
}
#contentDiv2{
width:200px;
height: 200px;
opacity: .5;
border:1px solid black;
}
</style>
<body>
<div id="containerDiv">
<div id="contentDiv1">
This is paragraph 1 with some dummy text.
</div>
<div id="contentDiv2">
This is paragraph 2 with some dummy text.
</div>
</div>
<script>
</script>
</body>
</html> আউটপুট

আসুন প্রস্থ এবং উচ্চতার বৈশিষ্ট্যের আরেকটি উদাহরণ দেখি -
উদাহরণ
<!DOCTYPE html>
<html>
<head>
<title>CSS height and width</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
#containerDiv {
margin: 0 auto;
height: 150px;
width:250px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>CSS height and width</legend>
<div id="containerDiv">
<img id="image" src="https://www.tutorialspoint.com/tensorflow/images/tensorflow-mini-logo.jpg">
</div>
</fieldset>
</form>
</body>
</html> আউটপুট
