【问题标题】:How to increase the width of the label ToolTip in ASP.NET如何在 ASP.NET 中增加标签 ToolTip 的宽度
【发布时间】:2013-12-04 05:33:14
【问题描述】:

我正在尝试在标签上显示一条长消息作为工具提示。一条短消息将在该标签中显示为文本。

由于消息太长,我想增加工具提示的宽度。有人可以帮我解决这种情况吗?

问候, 阿鲁娜

【问题讨论】:

    标签: asp.net label web-controls


    【解决方案1】:

    可以使用jquery来控制tooltip的宽度

    检查下面的代码,我认为它会解决您的要求

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <script>
            $(function () {
                $(document).tooltip();
            });
        </script>
        <style>
            label
            {
                display: inline-block;
                width: 5em;
            }
            .ui-tooltip
            {
                width: 210px;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <p> <label for="age"> Your age:</label><input id="age" title="We ask for your age only for statistical purposes."></p>
        </div>
        </form>
    </body>
    </html>
    

    【讨论】:

    • 您好,我只想在一个控件中更改此工具提示。这会将此样式添加到该页面中的所有控件。不是吗?
    • 你可以设置这个控件的id或者名字,然后像下面这样使用#txtAge.ui-tooltip { width: 210px; }
    猜你喜欢
    • 2020-09-01
    • 2020-09-14
    • 2019-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-30
    • 2013-07-18
    相关资源
    最近更新 更多