<div id="divReportHeader">
<div class="row-fluid">
<div class="SpanSimple" style="width: 569px; height: 26.456692913px;
margin:0px; border: 2px solid black;">
<div style="font-family: 'Times New Roman'; font-size: 26.66px;
text-align: center; vertical-align: text-top;
font-style: italic; font-weight: bold; text-decoration: none;">
Country Details
</div>
</div>
</div>
</div>
我在 php 变量 $headerHtml
中有上面的 html,我想得到分区的高度 .SpanSimple
包括 boarder-width
,margin-top
和 margin-bottom
。我已经尝试使用 simple_html_dom
获取高度的以下代码,但它没有帮助。
$html = str_get_html($headerHtml);
$e = $html->find("div", 2);
echo $e->height;
有什么建议或引用吗?
最佳答案
PHP 是一种服务器端语言,我怀疑您是否可以使用它来获取分区的高度。
但是,您可以使用 javascript 来做到这一点:
$(".SpanSimple").height()
关于php - 使用 simple_html_dom 在 php 中获取分区的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29775617/