gpt4 book ai didi

javascript - 如何使用 CSS 在基于 JavaScript 的按钮中添加换行符

转载 作者:太空宇宙 更新时间:2023-11-04 11:54:49 24 4
gpt4 key购买 nike

我使用 DataTable 创建了表格.它看起来像这样:

enter image description here

我想做的是像这样拆分它们:

enter image description here

如何使用自定义 CSS 实现这一点?我的 HTML 看起来像这样:

<html>
<head>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.css">
<link rel="stylesheet" href="http://cdn.datatables.net/colvis/1.1.2/css/dataTables.colVis.css">
<script type="text/javascript" language="javascript" src="./src/jquery-1.11.1.min.js"></script>
<script type="text/javascript" language="javascript" src="./src/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="./src/dataTables.colVis.min.js"></script>


<script>
$(document).ready(function() {
$('.sortable-table').DataTable( {
// Allow column selection, based on this
// https://datatables.net/extensions/colvis/
"dom": 'C<"clear">lfrtip',
// Except first column,
// it should stay.
// https://datatables.net/extensions/colvis/options
colVis:{exclude:[0]}
});
} );
</script>
<style>
body {
font-family: 'Helvetica Neue';
margin:150px;
}
img {
max-width:65%;
max-height:65%;
}
</style>
<title>Experiment 11</title>
</head>
<body>

<h2> G. Shared functional annotation</h2>
Here the functional analysis is scored with <tt>-log(Pvalue)</tt>.
<h3> LN </h3>
<table border="1" class="dataframe sortable-table display compact pure-table">
<thead>
<tr style="text-align: left;">
<th>GO</th>
<th>FOO</th>
<th>BAR</th>
</tr>
</thead>
<tbody>
<tr>
<td> regulation of response to wounding</td>
<td> 6.850</td>
<td> 11.975</td>
</tr>
</table>
</body>
</html>

最佳答案

按照你的例子:

<div class="ColVis" >
<button class="ColVis_MasterButton">
<span>Show / hide columns</span>
</button>
</div>

This is your html for that button now we are applying css to it

 .ColVis{
width:100%
}
button.ColVis_Button{
float:right
}

Provide Width 100% to your Colvis class and FLOAT:right to button.

注意:

如果可能,则为 colvis 和 button 应用新类,因为如果您更改 colVis 的样式,那么它可能会更改您的样式其他模板或在您的其他布局中,因此请先进行测试。

示例:http://jsfiddle.net/kevalbhatt18/urxk3q0z/2/

When you see output in jsfiddle first starch the size of output screen so you can see proper output

关于javascript - 如何使用 CSS 在基于 JavaScript 的按钮中添加换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30339753/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com