I have a problem with setting the appropriate text to the slider. I want the text to appear on the bottom right of the page. Only problem is the different resolutions (tablet, laptop, 24'' monitor).
Testing page: http://tinyurl.com/d825kuv
code:
div {
position:relative;
float:right;
vertical-align: bottom;
}
to move an element to the bottom of a <div>, set the parent <div>'s position to relative: position:relative, then the <div> you want to be placed at the bottom should have CSS
div {
position: absolute;
bottom: 0;
right:0;
}
then just adjust the pixel values to suit your layout.
Do:
position:absolute;
right:0px;
bottom:0px;
This will make sure that the element in question will be as far right, and as far down within the parent as possible. Of course if you wanted to pad it from the right/bottom just take the pixels up a notch. Note that position:absolute only works if the parent's position is not set as default. If in doubt give your parent the following style:
position:relative;
Related
Have a look at, http://thomaspalumbo.com
I have this CSS for my website's container:
.graybox {
padding: 0 30px 30px 30px;
background: #ededed;
position:absolute;
left:0;
right:0;
}
Then I have a container on top of that to center that info.
The .graybox container spreads the width of the page like I want but now my footer div is hidden, according to firebug is it actually behind? And up on the page?
Is there a fix for this?
While I'm here can anyone explain the white space on the right side of the page. It comes into effect once the page is resized smaller.
You can use the CSS z-index property to make sure your footer is in front of the content. Z-index only works when the element is positioned though. So make sure you add position:relative to your footer
#footer{
position:relative;
z-index:999;
}
Read more: http://www.w3schools.com/cssref/pr_pos_z-index.asp
EDIT
Just checked out the code of your website, and I don't understand why your graybox is positioned absolutely, this will only make things more complex. The same goes for your menu, why position it absolute, why not just add it in the right order in the HTML in the first place?
EDIT
If you want to center your content but with a background that has a 100% width then you can simply add a container div like so:
HTML
<div class="container">
<div>lorem ipsum....</div>
</div>
CSS
.container{
background:red;
}
.container div{
width:400px;
margin:0 auto;
background:yellow;
}
See JSFiddle here: http://jsfiddle.net/HxBnF/
Currently you cannot do this because you have a container which you set at 980px, don't ever do that unless you are sure you don't want anything to wrap over it, like in this case the background of a div in that container.
in the div style, just assign a z-index value greater than any other z-index such as
.divClass{
position: absolute;
z-index: 1 //if other elements are still visible chose a higher value such as 20 or even higher.
}
I have a problem in my web design assigment.
I can't make my 4 divs appear in a specific location in the screen.
Also need to mention that all of the 4 divs need to be overlap so I used z-index. But when I run my site on different screens the position always change although I used percents.
This is my css code (welcome, register, login, game are my div classes):
.welcome
{
position:absolute;
top:28%;
right:9%;
width:960px;
height:660px;
z-index: 3;
}
.register
{
position:absolute;
top:28%;
right:9%;
width:960px;
height:660px;
z-index: 2;
}
.Login
{
position:absolute;
top:28%;
right:9%;
width:960px;
height:660px;
z-index: 1;
}
.game
{
position:absolute;
top:28%;
right:9%;
width:960px;
height:660px;
z-index: 0;
}
The problem is that top and left properties only work for elements if these elements' (doesn't have to be direct) parent position is set to relative.
So you can either set body { position: relative;} or create a wrapper div around your 4 divs and set its position to relative.
Here is a fiddle with the code you need; you can position the elements however you wish, and the divs' margins will always be screensize-adapted.
http://jsbin.com/ogexev/1/edit
Note: I changed the width/ height properties a bit (divided by 3) to make them fit the screen.
PS: If many elements have the same properties, you're better off specifying them in one class. That's why I added a class .common in the fiddle.
It doesn't matter if you use percent in top and right, because the 28% of top in 1200px monitor and 960px height monitor is not the same. You must add the four divs inside a div. Create a div as a wrapper and it will work same on all the monitors. Because it doesn't matter the size of the screen the top and right values are the same.
Consider this JSFiddle: http://jsfiddle.net/GFsgq/5/ (you may have to zoom out a bit).
It shows a layout that I'm trying to achieve. So far it's been going alright, but I've hit a roadblock. I want to position two divs 77px in height side by side of the centered divs. They need to retain width to always touch the edge of the screen and their center div. I'm not sure how to do this with my limited knowledge of CSS, short of adding properties at random.
Her is a picture to help you understand: http://i49.tinypic.com/2ntz34n.png
The blue strips are where I want the divs to be. How do I achieve this?
You need to add this in your CSS:
header:after {
content: "";
display: block;
background-color: blue;
width: 100%;
height: 80px;
}
jsFiddle: http://jsfiddle.net/GFsgq/32/
fullsrcreen result: http://jsfiddle.net/GFsgq/32/embedded/result/
i would add parent div spanning thw dith of the screen with position:relative; and to the two child divs use position:absolute; and position one right:0px; and the other left:0px; I am unsure about how you want to distribute width, if you have any other problems then come back.
<div style="background-color:#303030;height:5.5%;">
<input type="text" style="border:1px solid;
top:50px;
bottom:10px;
height:90%;
left:20px;
width:25%;
" />
Here I have a dark div bar, with an input inside it. Why doesnt the top, bottom, left work as expected?
position:absolute;
display:inline-block;
Please note:
Your div has a height of 5.5%, and inside you place an input field 50px from the top, with a height of 90%(!). That is a huge input field. It makes no sense. Use either relative or exact measurements.
The div is missing a </div>
Don't mix-up mark-up and style (css)
In order for positioning to work, you need to declare what type of positioning to use... position: absolute; position:relative; position: fixed; etc...
You need to have the position of the element declared before you can position it in your page. The position property has 4 or 5 different settings. Inherit, absolute, fixed, static, and relative. Absolute won't work, because it needs a parent element that is positioned. Static is the default, and inherit inherits. Fixed freezes the element to the browser window. When you scroll, it won't move. Relative positions it from where it's supposed to be, so I think that's the one you would want.
I have a 3 column table layout with the center column being position:relative;
inside the center column I have a form which needs to be position:fixed; (well, unless there is another way)
What I need is the form to have a liquid width when the browser widens, but it also needs to stick to the bottom of the page. So, if I use position:fixed; it stays at the bottom, but it overlaps the right sidebar. If I use position:relative; it stays between the sidebars like it should, but it scrolls with the page.
I made a little jsfiddle but it doesn't display fixed positioning. But you can see my code. http://jsfiddle.net/winchendonsprings/S5zkm/1/
Here you can see it overlap the right sidebar. http://i.imgur.com/awp07.png
#center {
padding: 0 15px;
background-color: green;
position:relative;
}
div.main {
position:absolute;
bottom:0px;
left:0px;
right:0px;
}
You can try that (absolute positioning within relative positioning parent).
Play with the top and bottom values to position it vertically.
(It should resize with the window horizontally).
Is that what you want?