一些css属性不起作用

时间:2022-08-23 14:35:49

I want to place noscript tag like on this (*) page:

我想把noscript标签放在这个(*)页面上:

<noscript>Your browser has JavaScript turned off !</noscript>  

But, commented properties doesn't work:

但是,注释属性不起作用:

noscript{
    width:100%; // I want it to be 100% of parent container width - it's not.
    text-align:center;
    background-color:crimson;
    color:white;
    font-weight:bold;
    margin-top:10px; // doesn't work
    padding-top:7px;
    margin-bottom:10px; // doesn't work
    padding-bottom:7px;
}

3 个解决方案

#1


6  

Add display:block in your css to make it a block element, <noscript> is not a block element.

在css中添加display:block使其成为块元素,

#2


7  

noscript is not a block element. Put a DIV or any other block element inside your noscript element and then attempt to style it.

noscript不是块元素。将DIV或任何其他块元素放在noscript元素中,然后尝试对其进行样式化。

#3


1  

The content inside the <noscript> element will only be displayed if scripts are not supported, or are disabled in the user's browser. And it is not a block element.

只有在不支持脚本或在用户浏览器中禁用脚本的情况下,才会显示

Add display:block to your CSS.

添加显示:块到您的CSS。

#1


6  

Add display:block in your css to make it a block element, <noscript> is not a block element.

在css中添加display:block使其成为块元素,

#2


7  

noscript is not a block element. Put a DIV or any other block element inside your noscript element and then attempt to style it.

noscript不是块元素。将DIV或任何其他块元素放在noscript元素中,然后尝试对其进行样式化。

#3


1  

The content inside the <noscript> element will only be displayed if scripts are not supported, or are disabled in the user's browser. And it is not a block element.

只有在不支持脚本或在用户浏览器中禁用脚本的情况下,才会显示

Add display:block to your CSS.

添加显示:块到您的CSS。