Get division height in php using simple_html_dom
<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>
I have above html inside php variable $headerHtml, I want to get the height of division .SpanSimple, including boarder-width, margin-topand margin-bottom. I tried using the code below, using simple_html_domto get the height, but that doesn't help.
$html = str_get_html($headerHtml);
$e = $html->find("div", 2);
echo $e->height;
any suggestions or links?
+4
3 answers
, , style div, simple_html_dom. , height .
$html = str_get_html($headerHtml);
$e = $html->find("div", 2);
$tempStyleArray = array_map('trim', preg_split( "/[:;]+/", $e->style ));
$tempKey = array_search('height', $tempStyleArray);
$tempHeight = substr($tempStyleArray[$tempKey+1], 0, -2); //removing 'px'
echo $tempHeight;
0