内置内联样式,如何强行更改?

built-in inline styles, how do I forcefully change them?

提问人:Issac Howard 提问时间:10/6/2023 最后编辑:Heretic MonkeyIssac Howard 更新时间:10/7/2023 访问量:55

问:

我买了一个使用 bootstrap 和 jQuery 的模板,我想自定义它。由于它使用jQuery,我认为这可能与我面临的问题有关。我通常将我的问题分为两个角度。

用户视角:

用户看到一个丑陋的行高,并希望开发人员更改它。外观被压扁,需要删除线条高度。它看起来像这样。h1h1

enter image description here

你看到描述看起来如何被压扁了吗?

我希望它看起来像这样。enter image description here

开发者观点:

开发人员(我)快要发疯了,因为他尝试了以下方法:

  1. 设置内联行高样式
  2. 使用 Angular 指令
  3. 玩一下jQuery(虽然我对它很陌生)

我也刚刚学习了 HTML 中的属性。devTools 看起来有点奇怪,因为有很多data-*data-*

DevTools:

<div _ngcontent-ng-c801146963="" id="slide-1-layer-2" data-x="['right','left','center','center']" data-hoffset="['65','0','0','0']" data-y="['middle','middle','middle','middle']" data-voffset="['-0','-80','30','0']" 
data-fontsize="['60','60','60','30']" data-width="none" data-height="none" data-whitespace="nowrap" data-transform_idle="o:1;" data-transform_in="x:[-100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;opacity:0;s:2300;e:Power4.easeInOut;" data-transform_out="y:[100%];s:1000;e:Power2.easeInOut;s:1000;e:Power2.easeInOut;" data-mask_in="x:right;y:0;s:inherit;e:inherit;"
 data-mask_out="x:inherit;y:inherit;s:inherit;e:inherit;" data-start="750" data-splitin="none" data-splitout="none" data-responsive_offset="on" class="tp-caption slide-text-two tp-resizeme" style="z-index: 6; white-space: nowrap; font-family: &quot;Roboto Condensed&quot;, sans-serif;
 line-height: 16px; visibility: inherit; transition: none 0s ease 0s; text-align: inherit; border-width: 0px; margin: 0px; padding: 0px; letter-spacing: 0px; font-weight: 400; font-size: 33px; min-height: 0px; 
min-width: 0px; max-height: none; max-width: none; opacity: 1; transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform-origin: 50% 50% 0px;">

   <h1 _ngcontent-ng-c801146963="" appresponsivedirective="" id="lineHeight" style="line- 
   height: 14px; transition: none 0s ease 0s; text-align: inherit; border-width: 0px; 
   margin: 0px; padding: 0px; letter-spacing: 0px; font-weight: 700; font-size: 
   15px;">fitness is not a destination it is a way of life
   </h1>

</div>

如您所见,在 is 14px 中,正如您将在 app.html 中看到的那样,我没有将其设置为 14px。line-heighth1

app.html:

<!-- SLIDE  -->
<li data-index="rs-1" data-transition="slideoververtical">
    <!-- MAIN IMAGE -->
    <img src="../assets/assets/images/bg/bg-1.jpeg" alt="" data-bgposition="center center" data-bgfit="cover" data-bgrepeat="no-repeat" class="rev-slidebg" data-no-retina>

    <!-- LAYER NR. 1 -->
    <div class="tp-caption slide-text-one tp-resizeme" id="slide-1-layer-1" data-x="['right','center','center','center']" data-hoffset="['65','100','0','0']" data-y="['middle','middle','middle','middle']" data-voffset="['-100','-145','-60','-100']" data-fontsize="['inherit','20','20','17']"  data-width="none" data-height="none" data-whitespace="nowrap" data-transform_idle="o:1;" data-transform_in="x:[-100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;opacity:0;s:2000;e:Power4.easeInOut;" data-transform_out="y:[100%];s:1000;e:Power2.easeInOut;s:1000;e:Power2.easeInOut;" data-mask_in="x:right;y:0;s:inherit;e:inherit;" data-mask_out="x:inherit;y:inherit;s:inherit;e:inherit;" data-start="500" data-splitin="none" data-splitout="none" data-responsive_offset="on" style="z-index: 5; white-space: nowrap; font-family: 'Roboto Condensed', sans-serif; line-height: 30px;">
        <h1 appResponsiveDirective id="lineHeight">muscle <span>powerssss</span></h1>
    </div>

    <!-- LAYER NR. 2 -->
    <div class="tp-caption slide-text-two tp-resizeme" id="slide-1-layer-2" data-x="['right','left','center','center']" data-hoffset="['65','0','0','0']" data-y="['middle','middle','middle','middle']" data-voffset="['-0','-80','30','0']" data-fontsize="['60','60','60','30']"  data-width="none" data-height="none" data-whitespace="nowrap" data-transform_idle="o:1;" data-transform_in="x:[-100%];z:0;rX:0deg;rY:0;rZ:0;sX:1;sY:1;skX:0;skY:0;opacity:0;s:2300;e:Power4.easeInOut;" data-transform_out="y:[100%];s:1000;e:Power2.easeInOut;s:1000;e:Power2.easeInOut;" data-mask_in="x:right;y:0;s:inherit;e:inherit;" data-mask_out="x:inherit;y:inherit;s:inherit;e:inherit;" data-start="750" data-splitin="none" data-splitout="none" data-responsive_offset="on" style="z-index: 6; white-space: nowrap; font-family: 'Roboto Condensed', sans-serif; line-height: 30px;">
        <h1 appResponsiveDirective id="lineHeight" >fitness is not a destination it is a way of life</h1>
    </div>

    <!-- LAYER NR. 3 -->
    <div appResponsiveDirective id="lineHeight" class="tp-caption rev-btn white-btn" id="slide-1-layer-4" data-x="['right','left','center','center']" data-hoffset="['65','0','0','0']" data-y="['middle','middle','bottom','bottom']" data-voffset="['100','160','320','200']" data-width="none" data-height="none" data-whitespace="nowrap" data-transform_idle="o:1;" data-transform_hover="o:1;rX:0;rY:0;rZ:0;z:0;s:300;e:Power3.easeOut;" data-style_hover="c:rgba(255, 255, 255, 1.00);bc:rgba(255, 255, 255, 1.00);" data-transform_in="y:bottom;s:1200;e:Power4.easeInOut;" data-transform_out="y:[175%];s:1000;e:Power2.easeInOut;s:1000;e:Power2.easeInOut;" data-start="1250" data-splitin="none" data-splitout="none" data-actions='[{"event":"click","action":"jumptoslide","slide":"rs-164","delay":""}]' data-responsive_offset="on" data-responsive="off" style="z-index: 8; white-space: nowrap; font-size: 18px; line-height: 15px; color: rgba(255, 255, 255, 1.00);font-family:'Roboto Condensed', sans-serif;text-transform: uppercase; line-height: 30px;">learn more
    </div>
</li>

如您所见,我没有在 .lineHeighth1

现在,由于这个模板正在使用 jQuery 和 Bootstrap,有没有人对发生了什么有一个粗略的了解,因为为什么它给了我自动化的内置样式?

HTML jquery css twitter-bootstrap

评论

1赞 Rene van den Berg 10/6/2023
仅仅在网页上复制代码示例并不能复制你所看到的问题。不过,我不认为这是行高,因为行高本身不能像那样“挤压”文本。
1赞 A Haworth 10/7/2023
我不明白第 3 层中的两个 id,也不明白两个元素如何具有相同的 id(线高)。这是你的代码吗?
1赞 fnostro 10/7/2023
通常,模板有效。如果行为不端,那么更有可能是你自己的CSS重新定义了某种样式,导致它“挤压”。这可能只是一个摆脱自己的方式的问题<h1>
0赞 Issac Howard 10/7/2023
@user3302090 github.com/yousefmarey12/womengym,请随时慢慢来。感谢您的帮助!
0赞 Issac Howard 10/7/2023
@RenevandenBerg github.com/yousefmarey12/womengym,如果您想查看代码,请随时查看它。

答: 暂无答案