CSS Property Value How to - width: 50%;








Question

We would like to know how to width: 50%;.

Answer


<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of CSS center alignment</title>
<style type="text/css">
div {<!--   www  .  ja  va2  s . co  m-->
  width: 50%;
  margin: 0 auto;
  padding: 15px;
  background: #ffd99b;
}
</style>
</head>
<body>
  <div>This div container is center aligned horizontally.</div>
</body>
</html>

The code above is rendered as follows: