Issue
I am currently very new to css and html5.
I don't know what I have done wrong in the code please tell me my mistake.
Why Border in not showing in p tag?
<html>
<head>
<title>Margin</title>
<style>
h1{
border:10px solid red;
margin:25px 50px 75px 100px;
}
h3{
border:1px solid red;
margin:auto;
}
div{
margin:10px 100px 1cm 200pt;
}
h2.mf{
margin-bottom:inherit;
}
p.mf{/*Not Working*/
margin:inherit;
border: 5px solid red;
}
</style>
</head>
<body>
<h1>This is head 1.</h1>
<h3>This is head 3.</h3>
<div class= "mf">
<h2>This is again h2</h2>
<p>This is para....</p>
</div>
</body>
</html>
Solution
The selector p.mf
mean that p tag has class mf
.
You need change to .mf p
because your p tag inside div class mf
<html>
<head>
<title>Margin</title>
<style>
h1 {
border:10px solid red;
margin:25px 50px 75px 100px;
}
h3 {
border:1px solid red;
margin:auto;
}
div {
margin:10px 100px 1cm 200pt;
}
h2.mf {
margin-bottom: inherit;
color: green;
}
.mf p {/*Not Working*/
margin:inherit;
border: 5px solid red;
}
</style>
</head>
<body>
<h1>This is head 1.</h1>
<h3>This is head 3.</h3>
<div class= "mf">
<h2>This is again h2</h2>
<p>This is para....</p>
</div>
</body>
</html>
Answered By - Hien Nguyen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.