Как сделать одну часть текста заголовка другим шрифтом и добавить тире вокруг всего текста заголовка? - PullRequest
0 голосов
/ 08 мая 2020

Я пытаюсь создать что-то вроде этого:

enter image description here

Чтобы начать этот дизайн, я хотел бы сначала выделить одну часть текста заголовка жирным шрифтом (используя другой шрифт), как я могу выполнить sh это?

В настоящее время это порождает заголовок моего заголовка:

 <h2 class="h1  section-header--left" style="font-family: Geogrotesque Regular; color: #071435; font-size: 22px">MEEST POPULAIR</h2>

Чтобы сделать текст жирным, я использую шрифт «Geogrotesque SemiBold», кто-нибудь знает, как я могу добавить эту css в строку html и создать нужный мне дизайн? Таким образом, текст «Meest» должен быть шрифтом «Geogrotesque Regular», а текст «Populair» должен быть шрифтом «Geogrotesque SemiBold».

Было бы неплохо, если бы вы знали css, чтобы создать тире вокруг заголовка до

Нильс

1 Ответ

1 голос
/ 08 мая 2020

Это простой пример с другим шрифтом:

h2 {
font: 33px sans-serif;
margin-top: 30px;
text-align: center;
text-transform: uppercase;
}

h2.background {
position: relative;
z-index: 1;
}

 h2.background:before{
    border-top: 2px solid #dfdfdf;
    content:"";
    margin: 0 auto; /* this centers the line to the full width specified */
    position: absolute; /* positioning must be absolute here, and relative positioning must be applied to the parent */
    top: 50%; left: 0; right: 0; bottom: 0;
    width: 95%;
    z-index: -1;
}


span { 
    /* to hide the lines from behind the text, you have to set the background color the same as the container */ 
    background: #fff;
    padding: 0 15px;
    font-family:arial;
}


h2.double:before { 
/* this is just to undo the :before styling from above */
border-top: none; 
}

h2.double:after {
border-bottom: 1px solid blue;
-webkit-box-shadow: 0 1px 0 0 red;
-moz-box-shadow: 0 1px 0 0 red;
box-shadow: 0 1px 0 0 red;
content: "";
margin: 0 auto; /* this centers the line to the full width specified */
position: absolute;
top: 45%; left: 0; right: 0;
width: 95%;
z-index: -1;
}
<h2 class="background double"><span style='font-family: Geogrotesque Regular!important;' >FIRST</span><span style='font-family: cursive!important;'>TWO</span></h2>
...