想要在输入按钮中打破文本

时间:2014-04-11 07:22:12

标签: html

请找到以下链接,然后从Firefox浏览器中打开

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_button

而不是

value="Click me"

用下面的行替换这个词。

value="I want to break this sentence and make it fix width size like 400px and height should be auto."

需要打破400px宽度和高度的此按钮,根据我们的句子长度应该是自动的。

我现有的代码是

<input type="button" style="display: none; background: none!important; border: none;
                            padding: 0!important; 
 border-bottom: 1px solid #444; cursor: pointer; max-width: 400px; word-wrap: break-word;" onclick="openDrugsPopup(this);"
                            id="lnkdrg2" name="lnkdrg2" value="Drug 2" />

2 个答案:

答案 0 :(得分:3)

使用而不是为该按钮赋予宽度,相应地增加文本的高度

    <button style="width:100px">
     I want to break this sentence and make it fix widht size like 400px
      and height should 
      be auto. any one can help to resolve this issue asap.
     </button>

这适用于所有浏览器。

答案 1 :(得分:0)

<!DOCTYPE html>
<html>
    <head>
        <script>
            function msg()
            {
                alert("Hello world!");
            }
        </script>
    </head>
<body>

    <form>
        <input type="button" value="I want to break this sentence and make it fix widht size like 400px and height should be auto. any one can help to resolve this issue asap."     onclick="msg()" style="width=400px; height=auto;">
    </form>

    <p>The button above activates a JavaScript when it is clicked.</p>

</body>
</html>