Css: How to Position Element in Lower Right

CSS: how to position element in lower right?

Lets say your HTML looks something like this:

<div class="box">
<!-- stuff -->
<p class="bet_time">Bet 5 days ago</p>
</div>

Then, with CSS, you can make that text appear in the bottom right like so:

.box {
position:relative;
}
.bet_time {
position:absolute;
bottom:0;
right:0;
}

The way this works is that absolutely positioned elements are always positioned with respect to the first relatively positioned parent element, or the window. Because we set the box's position to relative, .bet_time positions its right edge to the right edge of .box and its bottom edge to the bottom edge of .box

How to position a div in bottom right corner of a browser?

This snippet works in IE7 at least

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Test</title>
<style>
#foo {
position: fixed;
bottom: 0;
right: 0;
}
</style>
</head>
<body>
<div id="foo">Hello World</div>
</body>
</html>

Align inside div to right bottom in CSS

Try this, setting your outer div to position: relative; ensure that the inner div will stay inside it when set to position: absolute;. Then you can specify it to sit in the bottom right corner by setting bottom: 0; right: 0;.

<div style="width:200px; height:200px; border:3px #FF6666 solid; position: relative">
<div style="font-weight:bold; text-align:right;position: absolute;bottom: 0; right: 0; ">Krishna</div>
</div>

Is it possible to absolutely position an element based on the bottom right corner of the element being positioned?

A simple tranform can do it. You may also add top:0;left:0 but it's not needed in this case:

#wrapper {
position: absolute;
bottom: 0;
right: 0;
width: 100px;
height: 100px;
background-color: red;
}

#position-me {
position: absolute;
transform: translate(-100%, -100%); /* this */
background: green;
}
<div id='wrapper'>
<div id='position-me'>
Text is here
</div>
</div>

Better way to align bottom right

You should make your wrapping class position:relative; and then whatever you have inside you can position absolutely position:absolute; bottom:0; right:0;

For example

HTML:

<div class="wrapper">
<div class="arrow"></div>
</div>

CSS:

.wrapper
{
width:100px;
height:100px;
position:relative;
}

.arrow
{
width:10px;
height:10px;
position:absolute;
right:0px;
bottom:0px;
}

How to fixed position bottom right in html css

make the .source outside tx element and it will be easy:

.container {
margin-top: -8px;
margin-left: -8px;
width: 750px;
padding-bottom: 750px;
float: left;
position: relative;
/* coord system stop */
top: 0px;
/* IE? */
background-size: cover;
/* background-size:contain; */
background-position: center center;
}

.divWrapper {
position: absolute;
top: 0px;
padding-top: 50%;
/* center the top of child elements vetically */
padding-bottom: 50%;
height: 0px;
width: 750px;
background-color: rgba(0, 0, 0, 0.30);
}

.tx {
position: relative;
background-color: transparent;
text-align: center;
/* horizontal centering */
-webkit-transform: translateY(-50%);
/* child now centers itself relative to the midline based on own contents */
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-ms-filter: 'progid:DXImageTransform.Microsoft.Matrix(M11=0.5, M12=0, M21=0, M22=0.5, SizingMethod="auto expand")';
/*IE8 */
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.5, M12=0, M21=0, M22=0.5, SizingMethod='auto expand');
/*IE6, IE7*/
transform: translateY(-50%);
/* text-shadow: 0px 4px 3px rgb(0 0 0), 0px 8px 13px rgb(0 0 0), 0px 18px 23px rgb(0 0 0 / 20%); */
font-size: 45px;
letter-spacing: 3px;
font-weight: normal;
line-height: normal;
color: #ffffff;
text-align: center;
padding: 0 75px 0 75px;
font-family: 'Righteous', cursive;
}

.markauthor {
color: white;
padding: 5px 20px 5px 20px;
background-color: #ff000061;
}

.source {
position: absolute;
bottom: 0;
right: 0;
font-size: 25px;
color: #ffffff8a;
margin: 0 15px 0 0;
font-family: 'Righteous', cursive;
text-shadow: 0px 4px 3px rgb(0 0 0), 0px 8px 13px rgb(0 0 0), 0px 18px 23px rgb(0 0 0 / 20%);
}
<link rel="stylesheet" type="text/css" href="./style.css">
<link href="https://fonts.googleapis.com/css?family=Righteous" rel="stylesheet">

<div class="container" style="background-image:url('https://images.unsplash.com/photo-1483721310020-03333e577078?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80');">
<div class="divWrapper">
<div style="font-size:30px; text-shadow: 0px 4px 3px rgb(0 0 0), 0px 8px 13px rgb(0 0 0), 0px 18px 23px rgb(0 0 0 / 20%);" class="tx">Bodybuilding is much like any other sport. To be successful, you must dedicate yourself 100% to your training, diet and mental approach. <br>
<span style="font-size:18px; line-height:5;"><mark class="markauthor">—Arnold Schwarzenegger—</mark></span>
</div>
<div class="source">advance.fitness.blog</div>
</div>
</div>

CSS: relative positioninig of bottom right

The only solutions I could come up with so far are:

http://jsfiddle.net/fmVz6/ - this requires a height and width to be defined on the "outer-box", not the inner-box (the inner must be absolutely positioned too).

Working on a second one at the moment ...

http://jsfiddle.net/fmVz6/1/ - this one does not require a height or width specified, it simply needs something inside the parent div (e.g. a space) to see the effect, otherwise the background doesn't appear.

Okay, to have it appear top-left of the link, http://jsfiddle.net/H5G8r/1/ (Requires some rearrangement of your HTML).

This one requires no width to be defined, and doesn't break the words onto multiple lines:
http://jsfiddle.net/H5G8r/2/

Take your pick :-)

Fix DIV to bottom right corner

You will want to set position: fixed; instead of position: absolute;.

Here's more info on the Position Property.

.bottomright {

position: fixed;

bottom: 0px;

right: 0px;

}

.demo {

background-color: HotPink;

padding: 20px;

margin: 5px;

}
Hello<br>

<div class="demo bottomright">

I'm a Div!

</div>

there


Related Topics



Leave a reply



Submit