Programming Code Center(PCC)
[CSS]

(PCC)::[How-to-use-Padding-and-element-width]::[css]

File Name : index.html

<!DOCTYPE html>
<html>
<head>
<style>
div.ex1 {
  width: 300px;
  background-color: yellow;
}

div.ex2 {
  width: 300px;
  padding: 25px;
  background-color: lightblue;
}
</style>
</head>
<body>

<h2>Padding and element width</h2>

<div class="ex1">This div is 300px wide.</div>
<br>

<div class="ex2">The width of this div is 350px, even though it is defined as 300px in the CSS.</div>

</body>
</html>

Output :

Padding and element width

This div is 300px wide.

The width of this div is 350px, even though it is defined as 300px in the CSS.