- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
给定来自不同数据源的节点结构,其中一个节点依赖于0到n个其他节点,但单个节点只能依赖于一个源的节点
const nodes = [
{ dataSourceId: "a", id: "a-1", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "a", id: "a-2", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "a", id: "a-3", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "b", id: "b-1", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "b", id: "b-2", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "b", id: "b-3", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1", "a-2"] },
{ dataSourceId: "c", id: "c-1", dependsOnDataSourceId: "b", dependsOnNodes: ["b-1"] },
{ dataSourceId: "c", id: "c-2", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-3", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-4", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-5", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2", "b-3"] },
{ dataSourceId: "c", id: "c-6", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2", "b-3"] },
{ dataSourceId: "e", id: "e-1", dependsOnDataSourceId: "c", dependsOnNodes: ["c-1", "c-3"] },
{ dataSourceId: "e", id: "e-2", dependsOnDataSourceId: "c", dependsOnNodes: ["c-3"] },
{ dataSourceId: "self-reference", id: "a-1", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "d", id: "d-1", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "d", id: "d-2", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
];
nodes
未排序,顺序是随机的(并且应该无关紧要)。
我想使用行跨度将此结构表示为 HTML 表。我所知道的是列的顺序,其中每个数据源代表一列
const dataSourceIds = ["a", "b", "c", "d", "e", "self-reference"];
dataSourceIds
中的第一项( "a") 始终代表根节点组。
首先我尝试“绘制”预期结果
table, th, td {
border: 1px solid black;
}
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
<th>d</th>
<th>e</th>
<th>self-reference</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="9">a-1</td>
<td>b-1</td>
<td>c-1</td>
<td><!-- Empty for source d --></td>
<td>e-1</td>
<td>a-1</td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td rowspan="6">b-2</td>
<td>c-2</td>
<td>d-1</td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td style="display: none"><!-- Covered by b-2 rowspan --></td>
<td rowspan="2">c-3</td>
<td>d-2</td>
<td>e-1</td>
<td><!-- Empty for source a-to-a --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td style="display: none"><!-- Covered by b-2 rowspan --></td>
<td style="display: none"><!-- Covered by c-3 rowspan --></td>
<td><!-- Empty for source d --></td>
<td>e-2</td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td style="display: none"><!-- Covered by b-2 rowspan --></td>
<td>c-4</td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td style="display: none"><!-- Covered by b-2 rowspan --></td>
<td>c-5</td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td style="display: none"><!-- Covered by b-2 rowspan --></td>
<td>c-6</td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td rowspan="2">b-3</td>
<td>c-5</td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-1 rowspan --></td>
<td style="display: none"><!-- Covered by b-3 rowspan --></td>
<td>c-6</td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td rowspan="2">a-2</td>
<td rowspan="2">b-3</td>
<td>c-5</td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td style="display: none"><!-- Covered by a-2 rowspan --></td>
<td style="display: none"><!-- Covered by b-3 rowspan --></td>
<td>c-6</td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
<tr>
<td>a-3</td>
<td><!-- Empty for source b --></td>
<td><!-- Empty for source c --></td>
<td><!-- Empty for source d --></td>
<td><!-- Empty for source e --></td>
<td><!-- Empty for source self-reference --></td>
</tr>
</tbody>
</table>
这是我迄今为止尝试过的
const nodes = [
{ dataSourceId: "a", id: "a-1", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "a", id: "a-2", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "a", id: "a-3", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "b", id: "b-1", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "b", id: "b-2", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "b", id: "b-3", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1", "a-2"] },
{ dataSourceId: "c", id: "c-1", dependsOnDataSourceId: "b", dependsOnNodes: ["b-1"] },
{ dataSourceId: "c", id: "c-2", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-3", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-4", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-5", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2", "b-3"] },
// breaks here because c-6 must also replace a-2 with a rowspan
// { dataSourceId: "c", id: "c-6", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2", "b-3"] },
{ dataSourceId: "e", id: "e-1", dependsOnDataSourceId: "c", dependsOnNodes: ["c-1", "c-3"] },
{ dataSourceId: "e", id: "e-2", dependsOnDataSourceId: "c", dependsOnNodes: ["c-3"] },
{ dataSourceId: "self-reference", id: "a-1", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "d", id: "d-1", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
// breaks here because b-2 must be added at c-3 but it tries to add it at c-2
// { dataSourceId: "d", id: "d-2", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
];
const dataSourceIds = ["a", "b", "c", "d", "e", "self-reference"];
// group the nodes by source so it's easier to inspect them
const groupedNodes = {};
for (const dataSourceId of dataSourceIds) {
groupedNodes[dataSourceId] = nodes.filter(node => node.dataSourceId === dataSourceId);
}
// extract the root node id so dataSourceIds only contains child sources
const rootNodeId = dataSourceIds.shift();
const rootNodes = groupedNodes[rootNodeId];
let rows = [];
// setup the initial rows with root nodes
for (const rootNode of rootNodes) {
const row = {
[rootNodeId]: rootNode
};
for (const dataSourceId of dataSourceIds) {
row[dataSourceId] = "empty";
}
rows.push(row);
}
// fill the rows with child nodes
for (let dataSourceIdIndex = 0; dataSourceIdIndex < dataSourceIds.length; dataSourceIdIndex++) {
const dataSourceId = dataSourceIds[dataSourceIdIndex];
const childNodes = groupedNodes[dataSourceId];
for (const childNode of childNodes) {
const { dependsOnDataSourceId, dependsOnNodes } = childNode;
for (const parentNodeId of dependsOnNodes) {
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
const row = rows[rowIndex];
const parentNode = row[dependsOnDataSourceId];
// parent node must exist in this row
if (parentNode === "empty") {
continue;
}
// parent node id must match
if (parentNode.id !== parentNodeId) {
continue;
}
// what if parent is covered?
// simply add it if there is no value yet
if (row[dataSourceId] === "empty") {
row[dataSourceId] = childNode;
continue;
}
// this row already has a value for this data source so we have to duplicate it
const duplicatedRow = structuredClone(row);
// replace the parent node with a rowspan
duplicatedRow[dependsOnDataSourceId] = { coveredByRowIndex: rowIndex };
// replace the previous child node with the current one
duplicatedRow[dataSourceId] = childNode;
// set all data source values between dependsOnDataSourceId ( exclusive ) and dataSourceIdIndex ( exclusive ) to empty because they are siblings with no data
const dependsOnDataSourceIdIndex = dataSourceIds.findIndex(previousDataSourceId => previousDataSourceId === dependsOnDataSourceId);
for (let emptyDataSourceIndex = dependsOnDataSourceIdIndex + 1; emptyDataSourceIndex < dataSourceIdIndex; emptyDataSourceIndex++) {
const emptyDataSourceId = dataSourceIds[emptyDataSourceIndex];
duplicatedRow[emptyDataSourceId] = "empty";
}
// check if there already are any covered rows
const amountOfCoveredRows = rows.filter(rowToInspect => {
const dataSourceValue = rowToInspect[dependsOnDataSourceId];
if (dataSourceValue.coveredByRowIndex === undefined) {
return false;
}
return dataSourceValue.coveredByRowIndex === rowIndex;
}).length;
const insertDuplicatedRowIndex = rowIndex + amountOfCoveredRows + 1;
// insert the new row after the last covered row
const previousRows = rows.slice(0, insertDuplicatedRowIndex);
const nextRows = rows.slice(insertDuplicatedRowIndex, rows.length);
rows = [
...previousRows,
duplicatedRow,
...nextRows
];
// but don't inspect this one in the next run
rowIndex++;
}
}
}
}
console.log(rows);
哪里
"empty"
意味着 <td>
元素为空coveredByRowIndex
意味着它应该使用 style="display: none"
代码效率低下,但现在这不重要,我想稍后优化它。
如您所见 rows
尚未包含预期结果。有 2 个节点破坏了算法。我对如何手动完成的想法
- group nodes by dataSourceId
- for each a, create a new row with empty values ( except for a )
- fill b
- if there already is a b, duplicate the row and replace the a with a "covered" index
- repeat for c
- repeat for c-6 but c-6 depends on b-3 and b-3 depends on a-2 so you must set a rowspan for a-2
- repeat for d
- repeat for d-2 but d-2 depends on b-2. It must not duplicate the row because there is enough space in the c-3 row
- repeat for e-1
- repeat for e-2 but you must replace d-2 with an "empty" value ( set all sources between parent key and own key to "empty" )
- repeat for self-reference
你们有什么想法可以解决这个问题吗?我不认为我需要最终的代码,我只是不知道如何设置算法......所以任何伪代码/算法建议都将受到高度赞赏!
最佳答案
我不是 100% 确信我已经理解您正在使用的完全通用的数据集可能是什么样子,但下面的代码将执行以下操作:
目前假设:
代码中的做法是:
代码中有一些进一步的解释性注释。
如果您需要修复/更改任何内容,请告诉我。
const nodes = [
{ dataSourceId: "a", id: "a-1", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "a", id: "a-2", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "a", id: "a-3", dependsOnDataSourceId: undefined, dependsOnNodes: [] },
{ dataSourceId: "b", id: "b-1", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "b", id: "b-2", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "b", id: "b-3", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1", "a-2"] },
{ dataSourceId: "c", id: "c-1", dependsOnDataSourceId: "b", dependsOnNodes: ["b-1"] },
{ dataSourceId: "c", id: "c-2", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-3", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-4", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "c", id: "c-5", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2", "b-3"] },
{ dataSourceId: "c", id: "c-6", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2", "b-3"] },
{ dataSourceId: "e", id: "e-1", dependsOnDataSourceId: "c", dependsOnNodes: ["c-1", "c-3"] },
{ dataSourceId: "e", id: "e-2", dependsOnDataSourceId: "c", dependsOnNodes: ["c-3"] },
{ dataSourceId: "self-reference", id: "a-1", dependsOnDataSourceId: "a", dependsOnNodes: ["a-1"] },
{ dataSourceId: "d", id: "d-1", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "d", id: "d-2", dependsOnDataSourceId: "b", dependsOnNodes: ["b-2"] },
{ dataSourceId: "d", id: "d-3", dependsOnDataSourceId: "c", dependsOnNodes: ["c-3"] }
];
// Build a list of structured nodes
dataSourceIds = [];
list = [];
selfRefs = [];
for ( var i = 0; i < nodes.length; i++ ) {
if ( nodes[i].dataSourceId == "self-reference" ) {
selfRefs.push(nodes[i].id);
} else {
if ( ! dataSourceIds.includes(nodes[i].dataSourceId) ) dataSourceIds.push(nodes[i].dataSourceId);
list.push([ nodes[i].id, nodes[i].dataSourceId, [], nodes[i].dependsOnNodes, undefined ]);
}
}
dataSourceIds.sort()
// A utility, given a node id return the structured node
function getListNode(id) {
for ( var i = 0; i < list.length; i++ ) {
if ( list[i][0] == id ) return list[i];
}
return undefined;
}
// Populate structured nodes with their structured parents
for ( var i = 0; i < list.length; i++ ) {
var parents = [];
for ( var j = 0; j < list[i][3].length; j++ ) {
parents.push(getListNode(list[i][3][j]));
}
list[i][3] = parents;
}
// Populate structured nodes with their structured children
for ( var i = 0; i < list.length; i++ ) {
for ( var j = 0; j < list[i][3].length; j++ ) {
list[i][3][j][2].push(list[i]);
}
}
// Get the structured nodes with no parents
treeRoots = [];
for ( var i = 0; i < list.length; i++ ) {
if ( list[i][3].length == 0 ) treeRoots.push(list[i]);
}
function spanner(node) {
// Calculate the row span required for a node, by recursively walking the tree for the node
var span;
if ( node[2].length == 0 ) {
span = 1
node[4] = span;
} else {
var span = 0;
for ( var i = 0; i < node[2].length; i++ ) {
span += spanner(node[2][i]);
}
node[4] = span
}
return span
}
// Utility to print a tree root
function printTR(treeRoots) {
var text = "";
for ( var i = 0; i < treeRoots.length; i++ ) {
text += printNT(treeRoots[i], 0);
}
return text;
}
// Utility to space out fields, indent, etc.
function spacer(n) {
var N = n * 4;
var text = "";
for ( var i = 0; i < N; i++ ) {
text += " "
}
return text;
}
// Utility to print a node tree
function printNT(node, depth) {
var text = "";
text += '<br>' + spacer(depth) + node[0] + spacer(1) + node[4] + spacer(1) + node[1];
for ( var j = 0; j < node[2].length; j++ ) {
text += printNT(node[2][j], depth + 1);
}
return text;
}
function tableTR(treeRoots) {
// Convert a root tree into a set of rows
var text = "";
for ( var i = 0; i < treeRoots.length; i++ ) {
var textRoot = '<tr>' + tableNT(treeRoots[i], "").replaceAll("</tr>", "<td></td></tr>");
// Add in a self reference
if ( selfRefs.indexOf(treeRoots[i][0]) != -1 ) {
ndx = textRoot.indexOf("</td></tr>");
text += textRoot.slice(0,ndx) + treeRoots[i][0] + textRoot.slice(ndx);
} else {
text += textRoot;
}
}
return text;
}
function sourcePadding(parent, child) {
// Generate empty table cells when child source is more than one source away from parent source.
// $ is to end of row of sources.
var text = "";
if ( child == "$" ) {
for ( var i = 1; i < dataSourceIds.length - dataSourceIds.indexOf(parent); i++ ) {
text += '<td>' + '</td>';
}
} else if ( parent != child && parent != "" ) {
for ( var i = 1; i < dataSourceIds.indexOf(child) - dataSourceIds.indexOf(parent); i++ ) {
text += '<td>' + '</td>';
}
}
return text;
}
function tableNT(node, parentSource) {
// Convert a node tree into table rows
var text = "";
if ( node[4] == 1 ) {
if ( node[2].length == 1 ) {
text += sourcePadding(parentSource, node[1]) + '<td>' + node[0] + '</td>' + tableNTfr(node[2][0], node[1]);
} else {
text += sourcePadding(parentSource, node[1]) + '<td>' + node[0] + '</td>' + sourcePadding(node[1], "$") + '</tr>';
}
} else {
text += sourcePadding(parentSource, node[1]) + '<td rowspan="' + node[4] + '">' + node[0] + '</td>' + tableNTfr(node[2][0], node[1]);
text += tableNTor(node[2][0], [ [ node[1], node[2][0][1] ] ]);
for ( var i = 1; i < node[2].length; i++ ) {
text += '<tr>' + tableNT(node[2][i], node[1])
}
}
return text;
}
function tableNTfr(node, parentSource) {
// The first row in a row span
var text = "";
if ( node[4] == 1 ) {
if ( node[2].length == 1 ) {
text += sourcePadding(parentSource, node[1]) + '<td>' + node[0] + '</td>' + tableNTfr(node[2][0], node[1]);
} else {
text += sourcePadding(parentSource, node[1]) + '<td>' + node[0] + '</td>' + sourcePadding(node[1], "$") + '</tr>';
}
} else {
text += sourcePadding(parentSource, node[1]) + '<td rowspan="' + node[4] + '">' + node[0] + '</td>' + tableNTfr(node[2][0], node[1]);
}
return text;
}
function tableNTor(node, skips) {
// The other rows in a row span
var text = "";
var skipped = [ ...skips ];
if ( node[2].length != 0 ) {
if ( node[4] > 1 ) {
skipped.push([ node[1], node[2][0][1] ]);
text += tableNTor(node[2][0], skipped)
for ( var i = 1; i < node[2].length; i++ ) {
text += '<tr>'
for ( var j = 0; j < skipped.length - 1; j++ ) {
text += sourcePadding(skipped[j][0], skipped[j][1], 0);
}
text += tableNT(node[2][i], node[1])
}
}
}
return text;
}
function tableHead(dataSourceIds) {
text = "";
for ( var i = 0; i < dataSourceIds.length; i++ ) {
text += '<th>' + dataSourceIds[i] + '</th>';
}
text += '<th>' + 'self-reference' + '</th>';
return '<tr>' + text + '</tr>';
}
function doStuff() {
for ( var i = 0; i < treeRoots.length; i++ ) {
spanner( treeRoots[i] );
}
var printerOne = document.getElementById("printerOne");
printerOne.innerHTML = printTR( treeRoots );
var treeTable = document.getElementById("treeTable");
treeTable.innerHTML = tableHead(dataSourceIds) + tableTR(treeRoots);
}
table {
border: 1px solid black;
}
th,
td {
border: 1px solid black;
}
<body onload="doStuff()">
<div>
Parsed nodes with calculated row spans and source:
<div id="printerOne">
</div>
</div>
<br>
<div>
Tree converted to table rows:<br>
<div>
<table id="treeTable">
</table>
</div>
</body>
关于javascript - 如何使用 rowspans 将树状结构转换为纯 HTML 表格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73897599/
大家好, 我看到了来自 java 项目中的 jsp 页面。 想问一下这些html标签有什么区别。 请多多指教。 示例代码如下: 最佳答案 使用struts-html标签库,其中只是普
我有一个页面,我正在从电子邮件中读取 HTML。 有时,来自电子邮件的文本包含 HTML 和 CSS,它完全改变了我的页面样式。 我不希望我的页面样式因此受到影响。我如何严格阅读特定 div(框)内的
我知道有类似的问题,但我想对我的特定代码进行一些输入。 我有一个图像,我将其切成 9 块,并创建了一个 3x3 HTML 表来显示它。 但是我的表在行之间有空格,但在列之间没有空格。我没有使用任何 C
编辑:Waylan 的回答成功了!谢谢! 我正在尝试压缩文档的 .html 文件以发送给客户。目标是获得与浏览实际网站相同的体验。 打开 .html 文件时,单击的任何链接都会转到父文件夹,而不是特定
编辑:Waylan 的回答成功了!谢谢! 我正在尝试压缩文档的 .html 文件以发送给客户。目标是获得与浏览实际网站相同的体验。 打开 .html 文件时,单击的任何链接都会转到父文件夹,而不是特定
这是 question 的扩展.我正在尝试解析嵌入在 Blogger 博客的 XML 备份中的 HTML 片段,并用 InDesign 标签重新标记它们。 Blogger 并未对其任何帖子的 HTML
我知道在 html 中元素之间的换行符被视为空格,但我认为当您尝试使用响应式布局时这非常可怕。 例如,这里我们有预期和正确的行为,但要获得它,我必须删除元素之间的 html 中的换行符: https:
我正在尝试将文本文件显示为 html。我正在使用 ionic 。我正在发送一个 html 格式的响应,但在一个文本文件中发送到配置文件页面。它在 .ts 页面的变量名中。 @Component({
假设我有一个 html 文档: test 我想在浏览器中显示该代码。然后我会创建类似的东西: <html>test<html> 为了在中间制作 gubbins,我有一个函数
HTML 元素和 HTML 标签有什么区别?渲染有什么区别吗?使用标签或元素时有什么特殊注意事项吗? 最佳答案 是一个标签,特别是一个开始标签 也是一个标签,一个结束标签 This is a para
我有这个表格的模态形式。该表正在填充大量数据,但我不想分页。相反,我想以模式形式降低表格的高度并为表格添加溢出。下面是我的代码,但它不起作用。 请问我该如何实现? CSS #table{
我记得有一个 Linux 命令可以从给定的 URL 返回 HTML 代码。您可以将 URL 作为此命令的参数,然后返回 HTML 代码,而不是在浏览器中输入 URL。 哪个命令执行此操作? 最佳答案
我有一个 html 页面,我想在其中包含另一个有很多链接的 html 页面。我能够使用 iframe 实现它,但我希望 iframe 内的页面具有与原始页面相同的文本和链接颜色属性,我不想要滚动条,我
我正在使用 HTML 写一本书。如果我把它写在一个 html 文件中,整个代码就会变长,所以我想将每一章保存到不同的文件中,然后将它们加载到主 html 中。我的意思是有像 chapter1.html
在显示之前,我必须将一个网站重定向到另一个网站。我试过使用 .htaccess,但它给我带来了问题。我也使用过 javavscript 和 meta,但在加载我要从中传输的页面之前它不起作用。帮助?
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
如何打印“html”标签,包括“”?如何在不使用文本区域和 Javascript 的情况下对任何标签执行此操作? 最佳答案 使用HTML character references : <html
我需要将 Ruby on Rails 应用程序中的 html.slim 文件转换为 html.erb。有什么简单的方法吗?我尝试了 Stack Overflow 和其他网站中列出的许多选项。但对我没有
这个问题在这里已经有了答案: Is it necessary to write HEAD, BODY and HTML tags? (6 个答案) 关闭 8 年前。 我在 gitHub 上找到了这个
如果不允许通过 JavaScript 进行额外的 DOM 操作,我正在寻找可以加载外部资源的元素列表。我正在尝试使用 HTML 查看器托管来自第三方的电子邮件,当发生这种情况时,我需要删除任何自动加载
我是一名优秀的程序员,十分优秀!