I have a text editor where user can enter raw HTML as a description. In some cases, there are some CSS styles in the text editor. I want to skip through the CSS and work only on string.
Raw HTML
<style type="text/css">.textleft{
margin-bottom:10px;
float:left;
display: inline-block;
width:56%;
text-align:left;
padding-right:20px;
padding-left:20px;
}
.textleft > p { display: table-cell; height: 150px; vertical-align: middle; }
.imageblock{
display:inline-block;
margin-bottom:10px;
width: 44%;
}
.textright{
margin-bottom:10px;
float:right;
display: inline-block;
width:56%;
text-align:left;
padding-left:20px;
padding-right:20px;
}
.containerz{
display:block;
}
.featimage{
vertical-align:middle;
display:inline-block;
width:53%;
max-height:245px;
}
.features{
vertical-align:middle;
display:inline-block;
width:46%;
padding-left:30px;
}
.textright > p { display: table-cell; height: 150px; vertical-align: middle; }
@media screen and (max-width: 991px) {
.textleft, .textright, .imageblock{
width:100%;
float:none;
padding-left: 0px;
padding-right: 0px;
}
/*.imageblock > img { width:100%;}*/
.containerz {text-align:center;}
.textright > p, .textleft > p { height: 100%; }
.textright, .textleft { margin-bottom: 0px; }
.features, .featimage { padding-left: 0px; width:100%; float:none;}
.features { padding-top: 10px;}
.imageblock {margin-bottom: 25px;}
}
</style>
<h1><strong>WhiteCoat Clipboard<sup>®</sup> - TEAL - Vertical Metric Medical Edition</strong></h1>
PHP strip_tags
$description = utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, 200) . '..',
above code only works if there are no CSS rules in $product_info['description']
for the above HTML, I get this
.textleft{ margin-bottom:10px; float:left; display: inline-block; width:56%; text-align:left; padding-right:20px; padding-left:20px; } .textleft > p { display: ..