0

Apologies for the vague title.

The question: Is there a way with CSS (avoiding JavaScript) to replace spaces with another character without the extra tags? e.x: <h1>coming soon</h1>

Here's an example of what I'd like to improve: example

<style>
    @import 'https://fonts.googleapis.com/css?family=Roboto+Mono';
    @import 'https://justinoboyle.github.io/font/stylesheet.css';
    * {
        font-family: 'Roboto Mono', monospace;
    }
    body {
        background-color: #01000f;
    }
    h1 {
        color: #1e88e5;
        font-size: 5vw;
    }
    h1 > endword:before {
        content: "·";
        color: #444444;
    }
    h1 > endword:after {
        content: "⏎";
        margin-left: 1vw;
        color: #444444;
        font-family: "carriagereturn";
    }
</style>

<h1>coming<endword>soon</endword></h1>

Thank you in advance, and if there is something that needs clarification, then please let me know in the comments.

Justin J. O'Boyle
  • 95
  • 1
  • 1
  • 10

2 Answers2

1

There are no completely CSS solutions to this challenge. I have prepared some rather hackish options you could try.

  1. With span tags you could use border-right or border-left. You cannot adjust the height of these because they match the element's dimensions exactly.

  2. Use the before and after Pseudo elements

    HTML: <h1>Hello</h1> <h1>world</h1>

    CSS: h1::after {content: url(dot.png) }

    The after pseudo-element will insert an image (or something else) after the content of the <h1>.

Harman
  • 346
  • 2
  • 6
  • That's fairly similar to what I have, though. I'm fearing that the answer is that I would have to run some JS to turn the traditional markdown into something like you mentioned. – Justin J. O'Boyle Jul 23 '16 at 06:05
0

If i understood your question correctly, I would suggest using &nbsp; in html, which creates whitespaces if thats what you're looking for.

John Boga
  • 484
  • 6
  • 14