更改 Bootstrap 表的字体大小
我正在使用 Bootstrap 表功能,这很棒,但我似乎无法更改字体大小。
我正在关注 https 的示例://examples.bootstrap-table.com/index.html#options/loading-font-size.html#view-source 但无论我将大小更改为什么,它都没有效果。
我做错了什么?
<!DOCTYPE html>
<html>
<head>
<!-- Bootstrap and Boostrap Table -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css">
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
</head>
<body class="home">
<div>
<table id="btTable" class = "table-sm">
<thead>
<tr>
<th data-field="fieldA" data-sortable="true">Field A</th>
<th data-field="fieldB" data-sortable="true">Field B</th>
<th data-field="fieldC" data-sortable="true">Field C</th>
</tr>
</thead>
</table>
</div>
<script defer>
let data = [
{
"fieldA": "purple",
"fieldB": "minivan",
"fieldC": 7,
},
{
"fieldA": "red",
"fieldB": "hatchback",
"fieldC": 26,
}]
var table = $("#btTable")
$(function() {
table.bootstrapTable({
data: data,
loadingFontSize: "30px"
})
})
</script>
</body>
</html>
I'm using the Bootstrap table functionality which is great but I cannot seem to change the font size.
I'm following the example at https://examples.bootstrap-table.com/index.html#options/loading-font-size.html#view-source but whatever I change the size to, it has no effect.
What am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<!-- Bootstrap and Boostrap Table -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/bootstrap-table.min.css">
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="https://unpkg.com/[email protected]/dist/bootstrap-table.min.js"></script>
</head>
<body class="home">
<div>
<table id="btTable" class = "table-sm">
<thead>
<tr>
<th data-field="fieldA" data-sortable="true">Field A</th>
<th data-field="fieldB" data-sortable="true">Field B</th>
<th data-field="fieldC" data-sortable="true">Field C</th>
</tr>
</thead>
</table>
</div>
<script defer>
let data = [
{
"fieldA": "purple",
"fieldB": "minivan",
"fieldC": 7,
},
{
"fieldA": "red",
"fieldB": "hatchback",
"fieldC": 26,
}]
var table = $("#btTable")
$(function() {
table.bootstrapTable({
data: data,
loadingFontSize: "30px"
})
})
</script>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更正它不会改变表格内容的字体大小,因为您尝试更改加载文本的字体大小。
尝试更改 css 字体大小的值,如下例所示。
Correct it won't change the font size of your table content as you are trying to change the font size of Loading text.
Try changing value of css font size like example below.
您可以使用普通的JavaScript进行样式。我仅在您的JavaScript代码中添加它:
此CSS类:
然后,您可以完全控制表格中的每个元素。
You can make the styling by using plain javascript. I add only this in your javascript code:
And this css class:
Then you have full control to change every element in you table.