程序问答   发布时间:2022-05-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了对齐横幅中心的文本大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决对齐横幅中心的文本?

开发过程中遇到对齐横幅中心的文本的问题如何解决?下面主要结合日常开发的经验,给出你关于对齐横幅中心的文本的解决方法建议,希望对你解决对齐横幅中心的文本有所启发或帮助;

我为我的网络应用制作了一个显示在 Internet Explorer 上的横幅,但里面的文字没有与中心对齐。你可以参下面的图片。

我的代码有什么错误?

对齐横幅中心的文本

下面是横幅的代码,下面提到了它的CSS。

HTML 代码:

<div class="bAnner" ID="bAnner_Strip">
    <span class="header-Font">Recommended to use Chrome,firefox or Microsoft Edge for better perfoRMANce and security</span>
    <button class="close-button" ID="close_button" onclick="closeBAnner()">X</button>
</div>

CSS 代码:

@media all and (-ms-high-contrast: nonE),(-ms-high-contrast: activE) {
    /* IE10+ CSS styles go here */
     .bAnner {
        visibility: visible ;
        BACkground-color: azure;
        padding-top: initial;
        text-align: center;
        height: 40px;
    }
    .header-Font {
        padding-top: 2px;
        padding-bottom: 2px;
        Font-size: 20px;
    }
    
    .close-button {
        text-align: right;
        Font-size: 10px;
        BACkground: none;
        border: none;
        
    }
}

解决方法

尝试将文本对齐中心添加到跨类

 .header-font {
    padding-top: 2px;
    padding-bottom: 2px;
    font-size: 20px;
    text-align: center;
}
,

如果有任何疑问让我知道,请尝试遵循 CSS。

.bAnner {
   visibility: visible ;
   BACkground-color: azure;
   padding-top: initial;
   text-align: center;
   height: 40px;
   display: inline-block;
   width: 100%;
}

.header-font {
   padding-top: 2px;
   padding-bottom: 2px;
   font-size: 20px;
   text-align: center;
}
@H_675_43@ @H_675_43@

@H_675_43@

@H_675_43@

大佬总结

以上是大佬教程为你收集整理的对齐横幅中心的文本全部内容,希望文章能够帮你解决对齐横幅中心的文本所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: