html - 按钮图标向右浮动不起作用

标签 html css kendo-ui glyphicons

我有一个按钮,里面有图标。我正在尝试使用 CSS float: right; 在左侧显示文本,在右侧显示图标。但图标和文字仍然居中显示。

这是 HTML:

<!DOCTYPE html>
<html>
<head>
    <base href="https://demos.telerik.com/kendo-ui/button/index">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.516/styles/kendo.common-bootstrap.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.516/styles/kendo.bootstrap.min.css" />
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2018.2.516/styles/kendo.bootstrap.mobile.min.css" />

    <script src="https://kendo.cdn.telerik.com/2018.2.516/js/jquery.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2018.2.516/js/kendo.all.min.js"></script>
    

</head>
<body>

        <div id="example">
            <div class="demo-section k-content">
                <div>
                    <h4>Basic Button</h4>
                    <p>
				
							
							<button id="primaryTextButton" class="k-button" title="Example of tool tip!" >Primary Button
							<span class="k-icon k-i-info">
							</button>
							</span>

                        
                    </p>
                </div>             
            <script>
                $(document).ready(function () {
                   
                });
            </script>

            <style>
                .demo-section p {
                    margin: 0 0 30px;
                    line-height: 50px;
                }
                .demo-section p .k-button {
                    margin: 0 10px 0 0;
                }
                .k-primary {
                    min-width: 150px;
                }
				.k-button {
				min-width: 400px;						
				}
				
				.k-icon{
					padding: 10px;
					font-size: 32px;					
				}
            </style>
        </div>

</body>
</html>

我在这里缺少什么?右边的图标显示需要改什么?

最佳答案

尝试将 div 包裹在您的 button 上并对其应用 overflow: auto

    <div style="overflow: auto;"><button id="reportBtn_33301" type="button" class="k-button k-button-icontext" title=" data-role="button" role="button" aria-disabled="false" tabindex="0">
<span class="k-icon k-i-info"></span>
Example
</button></div>

关于html - 按钮图标向右浮动不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50278323/

相关文章:

javascript - Bootstrap 表数据显示列 ="true"丢失输入的数据

html - 为什么 Twitter Bootstrap 2 btn-group 不起作用?

html - 如何给一个 Angular 8 组件主体一个背景色?

javascript - 如何在 jQuery 中使用其中心作为引用点来缩小 div?

css - Kendo UI - 是否可以针对每个组件使用不同的样式?

html - 在移动设备上垂直居中元素

html - 创建基于响应式网格的网页

html - 电子邮件 html 框架? (又名电子邮件 Bootstrap )

html - 如何将一个div放在上面,另一个放在下面?

javascript - 如何停止在 Kendo Grid 中添加空行?