[英]Do not know how to change font within code
嘿,我正在嘗試更改此代碼塊中所有內容的字體,但我不確定這是如何給出的
<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
當我嘗試時沒有任何改變
這是一個外部 CSS 選項。 我個人更喜歡盡可能多地使用外部 CSS。 如果您需要 HTML/CSS 基礎方面的幫助,請隨時給我發消息。
嘗試將 class 添加到您的起始 div 標記中。 像這樣:
<div class="waitlist--iframe">
然后在您的 .css 文件中,只需指定您要用於 class 的字體,如下所示:
.waitlist--iframe {
font-family: 'Times New Roman', sans-serif;
}
只需將“Times New Roman”替換為您想要的任何字體即可。 這樣它只將該字體系列分配給該 div 元素(以及您要將 class 添加到的任何其他元素。
選項 1:將字體系列添加為內聯樣式
選項 2:您已經有 id 選擇器 waitlist_iframe。 使用此選擇器添加 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.