1

I'm writing a Markdown theme in CSS but I have some issues with headers styling. Right now the h1 is styled as follows:

h1 {
  border-top: 1px solid black;
  width: 10%;
  margin: 0 0 100px 45%;
  padding: 0;
  text-align: center;
}

And it renders like this:

pic

The problem is, when the header contains a word which exceeds 10% in width, that word acts like left-aligned.

Key question:
How do I prevent very long words from being left-aligned, without adding HTML tags?

Filippo Costa
  • 488
  • 7
  • 25

1 Answers1

0

EDIT: Not what the OP looking for.

word-wrap: break-word;
word-break: break-all;

   h3 {
      /* omitted font details... */
      position: absolute;
      border-top: 1px solid #cccccc;
      width: 10%;
      margin: 0 87% 0 3%;
      text-align: center;
      padding: 0 1% 0 1%;
      word-wrap: break-word;
    }
Mark Ng
  • 200
  • 3
  • 11