CSS: How to insert guitar chords into the text in a space-saving manner?
I create HTML documents with song lyrics for printing. The lyrics are as large as possible. So, the more verses there are, the smaller the text.
Now I want to add chord information. This causes the line height to swell enormously, and the text no longer fits on A4:
Which CSS raises the chords while maintaining the line height? Here's what I experimented with:
akk_c::before { color: red; background: #eee; vertical-align: super; font-family: arial, sans-serif; font-size: 80%; } akk_c::before { content: "C"; }
Your previous implementation is not valid and can make it easier for you to read the value of the chord in a data attribute. The respective word is then nested in a and formatted with CSS.
HTML:
CSS:
The above structure perfectly aligns the chord to the element. It doesn’t matter what you set the line-height. The chord automatically moves along as it depends on the .
You can also alienate the element for this purpose, as you like it for the purpose of incorporating icons. It would be a little shorter.
Perfect, you can’t explain it better.
Looks good, unfortunately, doesn’t work. (Bin the next song)
If the Maibaum is again atDorfplatz ≤/akk_f> (if Maibaum is again at Dorfplatz
At [Firefox:Survey], the style for .cord is completely ignored, what can that be?
span was accepted, span.cord but not… funny
Do you think about your own definition of an HTML element? This would be valid in HTML5 if instead of an _ one – would be used, see https://www.mediaevent.de/html/custom-elements.html
I know you can create your own elements. It was actually about the spelling. The same scheme applies to the data attribute.
Error found. I wrote cordage with 4 letters, you chord with 5 letters. I only noticed a correct line in the editor was under a faulty line. The faulty one was shorter.
Interim report: Thank you, your proposal works when it alone in the document. Now I’m looking for why it doesn’t work in my environment.
You have to take the source code as I have specified it. Make up the unnecessary chip in CSS, as well as your akk_f etc.
The class is called chord (English for chord 😉 ). You must replace your “akk” with a or element and then enter the desired chord in the data attribute. Then it works.
Your HTML should look like this:
Your CSS:
acord = chord (I tried, maybe chord is a system term – no)