margin-left: 100 + 20%;
I want to do something the same as above. But CSS does not have any format. How can I successfully use these开发者_开发问答 together ?
Without javascript? Only by wrapping that content into another element (usually <div>
) and splitting that margin to two elements.
Something like:
<div style="margin-left:20%">
<div style="margin-left:100px">
<!-- content -->
</div>
</div>
Hi there and welcome to StackOverflow. Unfortunately CSS doesn't have this (good) behaviour, but LESS will. For a JavaScript implementation, look here. If you want a PHP implementation, look here. You may be confused as to why I'm talking about JS and PHP, but what LESS will do is take your .less
file and turn it into a vanilla CSS file, either on the client (JS), or on your server (PHP).
精彩评论