CSS h1、h2、h3 标题中的粗体字体 - 92590

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12591453/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 20:16:24  来源:igfitidea点击:

Bold font in h1, h2, h3 titles - 92590

csswordpresswordpress-theming

提问by Mark Badowski

I need help in finding out how to get a bold font in Elegant theme in WordPress, but only in the heading areas (h1, h2, h3 etc), since I have no problem getting it in the text body.

我需要帮助找出如何在 WordPress 的优雅主题中获得粗体字体,但仅限于标题区域(h1、h2、h3 等),因为我在文本正文中获取它没有问题。

I've tried, even though in the editor I'm getting bold headings, it's not the case once I publish the page, no matter what changes I make.

我试过了,即使在编辑器中我得到了粗体标题,但一旦我发布页面,无论我做了什么更改,情况都不是这样。

I'm including the code (not full but the part that matters) - none of the changes in 'h1' area are reflected once published, not even the font type, except the size. I'm not a coder so maybe there's something I'm missing. Please, help:

我包括了代码(不是完整的,而是重要的部分) - 一旦发布,'h1' 区域中的任何更改都不会反映出来,甚至字体类型也不会,除了大小。我不是编码员,所以也许我遗漏了一些东西。请帮忙:

/*------------------------------------------------*/

/* http://meyerweb.com/eric/tools/css/reset/ */
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; }

body { line-height: 1; }
ol, ul { list-style: none; }
blockquote, q { quotes: none; }


blockquote:before, blockquote:after,q:before, q:after { content: ''; content: none; }

/* remember to define focus styles! */
:focus { outline: 0; }

/* remember to highlight inserts somehow! */
ins { text-decoration: none; }
del { text-decoration: line-through; }

/* tables still need 'cellspacing="0"' in the markup */
table { border-collapse: collapse; border-spacing: 0; }


/*------------------------------------------------*/
/*-----------------[BASIC STYLES]-----------------*/
/*------------------------------------------------*/

body { line-height: 18px; font-family: 'Droid Sans', Arial, sans-serif; font-size: 15px; color: black; text-shadow: 1px 1px 1px #ffffff; background-color: #15191f; }

a { text-decoration: none; color: #00b7f3; }
a:hover { text-decoration: underline; }
.clear { clear: both; }
.ui-tabs-hide { display: none; }
br.clear { margin: 0px; padding: 0px; }

h1, h2, h3, h4, h5, h6 { padding-bottom: 5px; color: #111; letter-spacing: -1px; line-height: 1em; font-weight: bold; }
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: #111; }
h1 { font-size: 30px; font-weight: bold; font-family:"Times New Roman", Times, serif;}
h2 { font-size: 24px; }
h3 { font-size: 22px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }
p { padding-bottom: 10px; line-height: 18px; }
strong { font-weight: bold; color: #1c1c1c; }
cite, em, i { font-style: italic; }
pre, code { font-family: Courier New, monospace; margin-bottom: 10px; }
ins { text-decoration: none; }
sup, sub { height: 0; line-height: 1; position: relative; vertical-align: baseline; }
sup { bottom: 0.8em; }
sub { top: 0.3em; }
dl { margin: 0 0 1.5em 0; }
dl dt { font-weight: bold; }
dd  { margin-left: 1.5em;}
blockquote  { margin: 1.5em; padding: 1em; color: #666666; background: #e6e6e6; font-style: italic; border: 1px solid #dcdcdc; }
    blockquote p { padding-bottom: 0px; }

input[type=text],input.text, input.title, textarea, select { background-color:#fff; border:1px solid #bbb; padding: 2px; color: #4e4e4e; }
input[type=text]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus { border-color:#2D3940; color: #3e3e3e; }
input[type=text], input.text, input.title, textarea, select { margin:0.5em 0; }
textarea { padding: 4px; }

img#about-image { float: left; margin: 3px 8px 8px 0px; }

.clearfix:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */

/*------------------------------------------------*/
/*---------------[MAIN LAYOUT INFO]---------------*/
/*------------------------------------------------*/

#top { background: url(images/top-bg.png) repeat-x; }
    #top-wrapper { background: url(images/top-wrapper-bg.jpg) no-repeat top center; }
        #top-content { background: url(images/top-content-bg.png) repeat-x bottom left; }
            #bottom-light { background: url(images/bottom-light-bg.png) no-repeat bottom center; }
                .container { text-align: left; margin: 0 auto; width: 960px; position: relative; }
                    #top .container { padding-bottom: 60px; } 
                        #logo { margin: 65px 13px 35px; }
                        #menu { background: url(images/left-menu-bg.png) no-repeat top left; padding-left: 11px; height: 49px; }
                            #menu-right { background: url(images/right-menu-bg.png) no-repeat top right; padding-right: 11px; height: 49px; }
                                #menu-content { background: url(images/content-menu-bg.png) repeat-x; height: 49px; }
                        #social-icons { float: right; margin-right:23px; margin-top: 17px; }
                            #social-icons a { padding-left:4px; }       

#content { background: url(images/content-bg.png); border-top: 1px solid #ffffff; } 
    #content-shadow { background: url(images/content-shadow-bg.png) repeat-x top left; padding-top: 70px; padding-bottom: 37px; }   
        #services { margin-bottom: 40px; }
            .service { margin-right: 45px; width: 238px; float:left; position:relative; padding-left: 52px; }
                .last { margin-right: 0px; }
                    img.icon { position:absolute; top: 0px; left: 0px; }
                    .service h3.title  { font-size: 24px; margin-bottom: 8px; color: #1f262d; }
                    .service p { line-height: 21px; }
                    .service a.readmore { background:url(images/readmore.png) no-repeat right bottom; color:#1c2329; display:block; font-size:11px; height:24px; line-height:24px; padding-right:10px; text-shadow:1px 1px 1px #ffffff; display:block; float:right; }
                        .service a.readmore span { background:url(images/readmore.png) no-repeat;
display:block; height:24px; padding-left: 12px; padding-right: 2px; }
                        .service a.readmore:hover { color: #000; }

回答by SanCreative

Try CSS font-weight Property Values as:

尝试将 CSS font-weight 属性值设为:

h1, h2, h3, h4, h5, h6 {

  font-weight:100;

}

You can adjust values from 100, 200, 300, 400, 500, 600, 700, 800 to 900.The property value as 900is the thickest and 100is the lightest.

您可以从最厚和最轻100, 200, 300, 400, 500, 600, 700, 800 to 900.的属性值调整值。900100

回答by Tms91

Try adding

尝试添加

h1{
font-weight: bold;
}

to your external css file, or substitute your

到您的外部 css 文件,或替换您的

<h1> your text here </h1>

with

<h1 style="font-weight: bold"> your text here </h1>