CSS

How to style div with an inner border inside a div using CSS

In this tutorial, you will learn how to place a border inside a div block in CSS by simply using the CSS3 box-sizing property with border-box value.
 

Code CSS :
div {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    width: 500px;
    height: 100px;
    border: 15px solid red;
    background: black;
    margin: 10px;
    color: #fff;
}
 

Code HTML :
<!DOCTYPE html>
<html>
	<head>
	<style type="text/css">
		/* Put the CSS Style Here */
	</style>
	</head>
	<body>
		<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
	</body>
</html>
Result
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *