Alternate to float?

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Hello,

I am wondering... is there an alternative to "float:right;"?
When I use it inside a div it moves to the outside of the div.

Please help,
Cheers.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
I have four divs.
One named: "Wrapper"
Another named: "Title"
And another named: "Content"
And finally: "Signature"

They are all wrapped up into one box by the wrapper.
I want "Signature" to be placed at the right of the bottom of "Wrapper".
 

Kaz

BooYah
Staff member
Nov 16, 2010
3,065
1,034
so your html should look something like this

<div id = wrapper>
<div class = title> some title</div>
<div class = content> some content</div>
<div class = signature> some sig here</div

</div>

Post up your code as it make make it easier to pin point your error
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Here is my current:

HTML:
<!doctype HTML>
<html>
<head>
<title>Some tests</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<style type="text/css">
body{
    background-color:black;
}
#wrapper{
    border:solid;
    border-color:white;
    width:250px;
width: 700px ;
margin-left: auto ;
margin-right: auto ;
}
#content{
    height:230px;
    display:block;
    padding:10px;
    overflow:hidden;
    color:white;
    padding-left:12px;
    padding-right:12px;
    text-align:justify;
}
#title{
    padding:0.1px;
    margin-top:-3px;
    text-align:center;
    color:black;
    background-color:white;
}
#signature{
    float:right;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="title">
<p>Hello</p>
</div>
<div id="content">
<p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"</p><div id="signature">
<p>Posted by: Josh</p></div>
</div>
</div>
<script type="text/javascript">
$('#more').click(function(e) {
    e.stopPropagation();
    $('#content').css({
        'height': 'auto'
    })
});
 
$(document).click(function() {
    $('#content').css({
        'height': '40px'
    })
})
</script>
</body>
</html>
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
If you have that problem, I trust you have it all in-side a container. If so, you can use margin-left:20px / margin-right:20px;

Replacing the red text with the needed amount of px, and choose either left/right, depending on what you need.
 

Users who are viewing this thread

Top