问题和答案周围有自定义的div包装器。结束div在下一行产生空白行。我要删除该行。 发布链接http://fgstudy.com/uncategorized/a/
我已经尝试了空白CSS代码 CSS代码:
<?php
$data = array(
array("First Name" => "Abc 1", "Last Name" => "Abc 2", "Email" => "Abc1@gmail.com"),
array("First Name" => "Abc 2", "Last Name" => "Abc 2", "Email" => "Abc2@gmail.com")
);
function filterData(&$str)
{
$str = preg_replace("/\t/", "\\t", $str);
$str = preg_replace("/\r?\n/", "\\n", $str);
if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"';
}
// file name for download
$fileName = "new" . date('Ymd') . ".xls";
// headers for download
header("Content-Disposition: attachment; filename=\"$fileName\"");
header("Content-Type: application/vnd.ms-excel");
$flag = false;
foreach($data as $row) {
if(!$flag) {
// display column names as first row
echo implode("\t", array_keys($row)) . "\n";
$flag = true;
}
// filter data
array_walk($row, 'filterData');
echo implode("\t", array_values($row)) . "\n";
}
exit;
?>
HTML代码:
div#q1, div#a1, div#a2 { white-space: normal; }
P { white-space: normal;}
CSS代码:
<hr><div id="q1"><p>Which of the following the highest hydration energy</p>
</div><div id="a1"><p>Mg<sup>++</sup></p>
</div><div id="a2"><p>Li<sup>+</sup></p>
</div><div id="a2"><p>Na<sup>+</sup></p>
</div><div id="a2"><p>K<sup>+</sup></p>
</div>
<hr><div id="q1"><p>Which the correct statement</p>
</div><div id="a1"><p>Na<sup>+</sup>is smaller than Na atom</p>
</div><div id="a2"><p>Cl<sup>-</sup>is smaller than Cl atom</p>
</div><div id="a2"><p>Cl<sup>-</sup>(Ion) and Cl (atom) are equal in size</p>
</div><div id="a2"><p>Na<sup>+</sup>is larger than Na atom</p>
</div>
我想要文本消失后的空白。谁能帮我吗?
答案 0 :(得分:0)
您可以从p标签中删除边距,以删除文本下方的空白
p {
margin-bottom: 0px;
}
答案 1 :(得分:0)
每个div
内的段落似乎都设置了margin-bottom
属性。
.entry-content p { margin-bottom: 0; }
之类的东西将会摆脱它,或更具体地说:.entry-content > div p { margin-bottom: 0; }
答案 2 :(得分:-1)
在段落元素上使用空白属性:
p {
white-space: normal;
}