0
I want to line up a div to the right, but keep the margins as they were imposed, only he ignores them and stays out of the div box. I think with this picture you can see better
.answer {margin: 20px !important; float: right;}
I saw that many codes were missing to help you:
The CSS of the div "box":
.post{background: #fff; border: 1px solid #f0f0f0; padding: 10px; margin: auto auto 30px auto; width: 500px;}
The CSS of this "questions and answers":
.ask{margin: 0; padding: 0;}
.question{margin: 10px; position: relative; top: -10px;}
.asking{color: #012551; font-weight: bold; text-transform: lowercase;}
.answer {margin: 20px !important; float: right;}
.asking-avatar{border-radius: 100%; margin-left: 10px;}
.answer-avatar{border-radius: 100%; float: right;}
The HTML of "questions and answers"
{block:Answer}
<div class="ask">
<img src="{AskerPortraitURL-30}" class="asking-avatar"/>
<span class="question"><span class="asking">{Asker}</span>: {Question}</span>
<div class="answer">
<img src="{PortraitURL-30}" class="answer-avatar"/>
{Answer}
</div>
</div>
{/block:Answer}
Since the question does not have a code to see the context, the only thing I can say is: avoid using float. There are other ways to align an element, but without HTML and CSS code you cannot say for sure that it should be done.
– Sam