Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

CSS Border

Try something like this:
HTML:
<html>

  <style>
    #border {
      position: relative;
      width: 50%;
      height: 50%;
      left: 25%;
      top: 25%;
      border-top: solid black 10px; /*top border*/
      border-bottom: solid black 10px; /*bottom border*/
      background-image:
      repeating-linear-gradient(to bottom, black 0%, black 10%, transparent 10%, transparent 100%),
      repeating-linear-gradient(to bottom, black 0%, black 10%, transparent 10%, transparent 100%); /*these are to specify the space in between the dashed line*/
      background-position: left top, right top;
      background-repeat: repeat-y, repeat-y;
      background-size:10px 91%, 10px 91%;
    }
  </style>

  <body>
    <div id="border"></div>
  </body>

</html>

You can check this link for more on repeating-linear-gradient

Maybe you can even do this with linear-gradient instead of repeating-linear-gradient. I'm not too sure.
 
Last edited:
Try something like this:
HTML:
<html>

  <style>
    #border {
      position: relative;
      width: 50%;
      height: 50%;
      left: 25%;
      top: 25%;
      border-top: solid black 10px; /*top border*/
      border-bottom: solid black 10px; /*bottom border*/
      background-image:
      repeating-linear-gradient(to bottom, black 0%, black 10%, transparent 10%, transparent 100%),
      repeating-linear-gradient(to bottom, black 0%, black 10%, transparent 10%, transparent 100%); /*these are to specify the space in between the dashed line*/
      background-position: left top, right top;
      background-repeat: repeat-y, repeat-y;
      background-size:10px 91%, 10px 91%;
    }
  </style>

  <body>
    <div id="border"></div>
  </body>

</html>

You can check this link for more on repeating-linear-gradient

Maybe you can even do this with linear-gradient instead of repeating-linear-gradient. I'm not too sure.
Interesting, so the repeating-linear-gradient is acting as the border? (if that makes sense)
 
Interesting, so the repeating-linear-gradient is acting as the border? (if that makes sense)
Yes, it is. You just have to play around with some of the values until you get what you want. It's a little confusion to use (at least for me), but eventually I got it.

I looked a bit at linear-gradient, and I think that might actually be easier to use for this.
 
I managed to do the same with linear-gradient, this might be a little easier to use.

Replace
CSS:
repeating-linear-gradient( to bottom, black 0%, black 10%, transparent 10%, transparent 100%),
repeating-linear-gradient( to bottom, black 0%, black 10%, transparent 10%, transparent 100%);
with
CSS:
linear-gradient(black 10%, transparent 0%, transparent 100%, black 0%),
linear-gradient(black 10%, transparent 0%, transparent 100%, black 0%);
 
Back
Top Bottom