0

My code is below but it is not working. I want to add a dotted line after each section which has width 100%.

section::after {
    border-bottom: 1px dotted red;
}
zhuzhi
  • 53
  • 3

3 Answers3

2

just remove ::after borders apply to elements. adding content won't create a line across the page. Not sure why this was voted down. It works and is pretty straight forward.

section {
    border-bottom: 1px dotted red;
}
<section></section>
DCR
  • 14,737
  • 12
  • 52
  • 115
0

May be ul will be work for you,

HTML:

<ul>
    <li><span>Name:</span></li>
    <li><span>Age:</span></li>
</ul>

CSS:

ul li {
    border-bottom: 2px dotted #ccc;
}

I created a demo for you in JSFiddle

INDRAJITH EKANAYAKE
  • 3,894
  • 11
  • 41
  • 63
0

I hope this works for you :

<!DOCTYPE html>
<html>

<head>
  <style>
    section {
      display: block;
      width: 100%;
    }
    
    section::after {
      content: " ";
      display: block;
      width: 100%;
      border: 2px solid red;
    }
  </style>
</head>

<body>

  <section>
    <h1>WWF</h1>
    <p>The World Wide Fund for Nature (WWF) is an international organization working on issues regarding the conservation, research and restoration of the environment, formerly named the World Wildlife Fund. WWF was founded in 1961.</p>
  </section>
Abhishek Pakhare
  • 476
  • 1
  • 4
  • 15