Zum Hauptinhalt springen
Blog & News

Aktuelles & Updates von
Joomla, Wordpress und Co.

News, HowTos und Tutorials rund um Webdesign, Webentwicklung, Webhosting und Digitalisierung.

Blog & News

Copyright Symbol © automatisch hochsetzen

07.03.2022 · 1 Min Lesezeit

Zwei Wege

CSS

@font-face {
font-family: 'MyFont';
src: url(https://fonts.googleapis.com/css2?family=Space+Mono&display=swap);
unicode-range: U+000AE, U+000A9;
}
p{font-family: 'MyFont', 'Open Sans', sans-serif;}

JavaScript

   $(function() {
        $('h1,p,a,span,li,dl,td').each(function(i, elem) {
            $(elem).html(function(i, html) {
                return html.replace(/\u00ae/g, "<sup>&reg;</sup>");
            });
            $(elem).html(function(i, html) {
                return html.replace(/\u00a9/g, "<sup>&copy;</sup>");
            });
        });
    });

Quellen:

https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/unicode-range#using_a_different_font_for_a_single_character

https://stackoverflow.com/questions/28050432/replacing-copyright-registered-symbols-with-superscripted-html

Zurück zur Übersicht