Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I move a div over to the right side of the screen but have the text align of the left border of the div?

Tags:

html

css

here's my code:

<div id="Notify" style="clear:both;">
    <div style="text-align:right;">
        <div style="text-align:left;">
            Send Table to Standards By Email. (everything below is a placeholder)
            <br /><br />
            Saved at: @DateTime.Now.ToString()
            <br />  
            Saved by: 107
            <br /><br />
            <input type="submit" value="Send Email" />
        </div>
    </div>
</div>
<br />
<br />
<div id="PTable">
    Products Table Placeholder
</div>

When I try this, everything is aligned to the left. If I use float:right, then PTable and Notify are side by side. As opposed to PTable being below Notify.

What I would like is: Notify on top and all the text in its inner div aligned on the left border of the inner div. PTable under Notify aligned how the browser sees fit.

like image 526
dotnetN00b Avatar asked Jul 20 '12 19:07

dotnetN00b


2 Answers

You want to use both float: right and then text-align: left on div#Notify to achieve this effect. Further, to make sure PTable does not show up beside Notify, use clear: both.

#Notify, #PTable {
    clear: both;
}

#Notify {
    float: right;
    text-align: left;
}

JS Fiddle: http://jsfiddle.net/SDDG2/2/

like image 91
JSW189 Avatar answered Sep 23 '22 00:09

JSW189


This seems to work!

<div id="Notify" style="clear:both;">
    <div style="float:right;">
        <div style="text-align:left;">
            Send Table to Standards By Email. (everything below is a placeholder)
            <br /><br />
            Saved at: @DateTime.Now.ToString()
            <br />  
            Saved by: 107
            <br /><br />
            <input type="submit" value="Send Email" />
        </div>
    </div>
</div>
<br />
<br />
<div id="PTable" style="clear:both;">
    Products Table Placeholder
</div>
like image 38
dotnetN00b Avatar answered Sep 23 '22 00:09

dotnetN00b