View Single Post
Old 10-11-2020, 11:18 AM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 80,025
Karma: 147977995
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
[QUOTE=RbnJrg;4045768]I posted my solution in order that it works everywhere. What you want, it can be achieved with the following code:

1. In your .xhtml file:

Code:
<div class="heading">
  <h1 class="block">CHAPTER 1</h1>
</div>
You don't need the excess <div>. Excess code is not a good idea. The style for the h1 class should be chapter.
Code:
<h1 class="chapter">CHAPTER 1</h1>
Quote:
]2. In your .css file:

Code:
.heading {
     text-align: center;
}

h1 {
    display: inline;
    font-size: 1.1em;
    font-family: sans-serif;
    margin: 1em auto;
}

.block {
    display: inline-block;
    background: teal;
    color: white;
    padding: 0.25em 1em;
}
The CSS code should be more like...
Code:
.chapter {
  font-size: large;
  font-weight: bold;
  font-family: sans-serif;
  margin-top: 1em;
  margin-bottom: 1em;
}
I've managed to cut down a significant portion of code and it does the very same thing. The idea is to keep it simple. The extra code is not simple.
JSWolf is offline   Reply With Quote