简体   繁体   English

不知道如何在代码中更改字体

[英]Do not know how to change font within code

Hey I'm trying to change the font of everything in this code block and I'm not sure how this is what is given嘿,我正在尝试更改此代码块中所有内容的字体,但我不确定这是如何给出的

<div>
            <iframe 
                id="waitlist_iframe"
                title="waitlist" 
                frameborder="0" 
                marginheight="0" 
                marginwidth="0" 
                width="600px"
                height="400px"
                src="{code}"
                style="border-radius: 8px;"
            >

            </iframe>
  
        </div>

        <script>
            const url = new URL(window.location.href);
            const ref_id = url.searchParams.get('ref_id');
            if (ref_id) {
                document.getElementById("waitlist_iframe").src += `?ref_id=${ref_id}`;
            }

  

        </script>
.container--waitlistapi // outermost div containing the component
.container--waitlistapi > h1 // main heading
.button--waitlistapi // main submit button
.input--waitlistapi // input fields
.statusToggleLabel // "Signed up before?" label
.statusToggleLabel > a // "Check your status" link

Nothing is changing when I attempt当我尝试时没有任何改变

This is an External CSS option.这是一个外部 CSS 选项。 Personally I prefer using external CSS as much as I can.我个人更喜欢尽可能多地使用外部 CSS。 If you need help with HTML/CSS fundamentals feel free to message me.如果您需要 HTML/CSS 基础方面的帮助,请随时给我发消息。

Try adding a class to your opening div tag.尝试将 class 添加到您的起始 div 标记中。 Like this:像这样:

<div class="waitlist--iframe">

Then in your.css file just specify the font you want to use for your class, like this:然后在您的 .css 文件中,只需指定您要用于 class 的字体,如下所示:

.waitlist--iframe {
         font-family: 'Times New Roman', sans-serif;
     }

Just replace 'Times New Roman' with whatever font you want.只需将“Times New Roman”替换为您想要的任何字体即可。 That way it assigns that font-family only to that div element (and whatever other element you want to add that class to.这样它只将该字体系列分配给该 div 元素(以及您要将 class 添加到的任何其他元素。

Option-1: Add font-family as inline style选项 1:将字体系列添加为内联样式
Option-2: You have already id selector waitlist_iframe.选项 2:您已经有 id 选择器 waitlist_iframe。 use this selector to add styles. option1:使用此选择器添加 styles。选项 1:

<iframe 
                id="waitlist_iframe"
                title="waitlist" 
                frameborder="0" 
                marginheight="0" 
                marginwidth="0" 
                width="600px"
                height="400px"
                src="{code}"
                style="border-radius: 8px;font-family: 'Times New Roman', sans-serif;"
            >

            </iframe>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM