Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html IE中的按钮文本被截断_Html_Css_Internet Explorer - Fatal编程技术网

Html IE中的按钮文本被截断

Html IE中的按钮文本被截断,html,css,internet-explorer,Html,Css,Internet Explorer,以下HTML在Chrome中正确显示,但在IE中不正确。按钮文本被截断 <HTML> <HEAD> <TITLE>Button test</TITLE> <STYLE type="text/css"> p { padding-left: 2em; text-indent: -2em } </STYLE> </HEAD> <BODY>

以下HTML在Chrome中正确显示,但在IE中不正确。按钮文本被截断

<HTML>
   <HEAD>
      <TITLE>Button test</TITLE>
      <STYLE type="text/css">
      p { padding-left: 2em; text-indent: -2em }
      </STYLE>
   </HEAD>
   <BODY>
   <DIV style="margin-left: 0.5in; margin-right: 0.5in">First line<P>Second line<BUTTON>Button will be clicked</BUTTON>
   </DIV>
   </BODY>
</HTML>

按钮测试
p{左填充:2em;文本缩进:-2em}
将单击第一行

第二行按钮


p
样式条目背后的想法是,我希望段落的第一行显示在剩余行的左侧。我已将此简化为一个最小的示例,但通常会为
按钮设置onclick事件
,我发现在IE中,如果
按钮发生在
p
内部,则段落元素的
文本缩进属性将由
按钮继承,使其向左移动文本,使部分文本从按钮上脱落。可以通过将
style=“text indent:0”
添加到
按钮中,或将其添加到样式表中来解决此问题:

  button { text-indent: 0 }