gpt4 book ai didi

html - 需要 CSS 来换行这个文本

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

我需要做什么才能让“标题”包含在这个片段中?此外,当它包裹时,它应该将 table 向下推。下面是一张图片。我希望以 This is the title 开头的行换行。

Need the Title to Wrap

我已经导入了 JS Fiddle

代码:

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ANSI">
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<style type='text/css'>

#body {
width:400px;
margin:0 auto;
background-color: #fff;
}

#content-1 {
float:left;
width:100%;
background:#f7f7f7;
}

#wrapper { bottom:0;overflow: hidden; }
.tablecontent { z-index: 99; margin: 10px; padding: 35px 5px 5px 5px;background-color:#FFFFFF; border: 1px solid; border-color: #B8B8B8; border-radius: 4px;}
.tabletitle {color: #005c9c;padding-top: 20px;padding-left: 20px;z-index: 100;position:absolute;}
</style>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart","table"]});

google.setOnLoadCallback(drawChart);
function drawChart() {

var cssClassNames = {
'tableCell': 'wrapall'};



var datatable = new google.visualization.DataTable();
datatable.addColumn('string','Country','col1');
datatable.addColumn('number','Metric 1');
datatable.addColumn('number','Metric2');
datatable.addColumn('number','Metric3');
datatable.addRows(2);
datatable.setCell(0,0,'United States');
datatable.setCell(0,1,7);
datatable.setCell(0,2,306);
datatable.setCell(0,3,67.32,'67.32%');
datatable.setCell(1,0,'India');
datatable.setCell(1,1,5);
datatable.setCell(1,2,139);
datatable.setCell(1,3,76.98,'76.98%');

var table = new google.visualization.Table(document.getElementById('dashboardtable_20'));
table.draw(datatable, {showRowNumber: false, 'allowHtml': true, 'cssClassNames': cssClassNames});
}
</script>





</head>
<body>
<div id="body">
<div id="wrapper">
<div id="main">
<div id="content-1">
<div class="tabletitle">This is the title of my widget. But I want this to wrap if the title is long.</div>
<div id="dashboardtable_20" class="tablecontent"></div>
</div>

</div>


</div>
</body>
</html>

最佳答案

我建议不要使用 position:absolute,而是尝试匹配标题和表格的样式,如下所示:

.tablecontent {
margin: 10px;
padding: 5px;
background-color: #FFFFFF;
border: 1px solid #B8B8B8;
border-radius: 0 0 4px 4px;
border-top: none;
margin-top: 0;
}
.tabletitle {
color: #005c9c;
padding: 5px;
background: white;
border: 1px solid #B8B8B8;
border-bottom: none;
margin: 10px;
margin-bottom: 0;
border-radius: 4px 4px 0 0;
}

DemoFiddle

关于html - 需要 CSS 来换行这个文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28368602/

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