How align horizontally images inside link? [duplicate] - html

How can I center align (horizontally) an image inside its container div?
Here's the HTML and CSS. I have also included the CSS for the other elements of the thumbnail. It runs in descending order so the highest element is the container of everything and the lowest is inside everything.
#thumbnailwrapper {
color: #2A2A2A;
margin-right: 5px;
border-radius: 0.2em;
margin-bottom: 5px;
background-color: #E9F7FE;
padding: 5px;
border: thin solid #DADADA;
font-size: 15px
}
#artiststhumbnail {
width: 120px;
height: 108px;
overflow: hidden;
border: thin solid #DADADA;
background-color: white;
}
#artiststhumbnail:hover {
left: 50px
}
<!--link here-->
<a href="NotByDesign">
<div id="thumbnailwrapper">
<a href="NotByDesign">
<!--name here-->
<b>Not By Design</b>
<br>
<div id="artiststhumbnail">
<a href="NotByDesign">
<!--image here-->
<img src="../files/noprofile.jpg" height="100%" alt="Not By Design" border="1" />
</a>
</div>
<div id="genre">Punk</div>
</div>
Okay, I have added the markup without the PHP in so should be easier to see. Neither solution seems to work in practice. The text at top and bottom cannot be centered and the image should be centered within its container div. The container has overflow hidden so I want to see the center of the image as that's normally where the focus is.

#artiststhumbnail a img {
display:block;
margin:auto;
}
Here's my solution in: http://jsfiddle.net/marvo/3k3CC/2/

CSS flexbox can do it with justify-content: center on the image parent element. To preserve the aspect ratio of the image, add align-self: flex-start; to it.
HTML
<div class="image-container">
<img src="http://placehold.it/100x100" />
</div>
CSS
.image-container {
display: flex;
justify-content: center;
}
Output:
body {
background: lightgray;
}
.image-container {
width: 200px;
display: flex;
justify-content: center;
margin: 10px;
padding: 10px;
/* Material design properties */
background: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.image-2 {
width: 500px;
align-self: flex-start; /* to preserve image aspect ratio */
}
.image-3 {
width: 300px;
align-self: flex-start; /* to preserve image aspect ratio */
}
<div class="image-container">
<img src="http://placehold.it/100x100" />
</div>
<div class="image-container image-2">
<img src="http://placehold.it/100x100/333" />
</div>
<div class="image-container image-3">
<img src="http://placehold.it/100x100/666" />
</div>

I just found this solution below on the W3 CSS page and it answered my problem.
img {
display: block;
margin-left: auto;
margin-right: auto;
}
Source: http://www.w3.org/Style/Examples/007/center.en.html

This also would do it
#imagewrapper {
text-align:center;
}
#imagewrapper img {
display:inline-block;
margin:0 5px;
}

The best thing I have found (that seems to work in all browsers) for centering an image, or any element, horizontally is to create a CSS class and include the following parameters:
CSS
.center {
position: relative; /* where the next element will be automatically positioned */
display: inline-block; /* causes element width to shrink to fit content */
left: 50%; /* moves left side of image/element to center of parent element */
transform: translate(-50%); /* centers image/element on "left: 50%" position */
}
You can then apply the CSS class you created to your tag as follows:
HTML
<img class="center" src="image.jpg" />
You can also inline the CSS in your element(s) by doing the following:
<img style="position: relative; display: inline-block; left: 50%; transform: translate(-50%);" src ="image.jpg" />
...but I wouldn't recommend writing CSS inline because then you have to make multiple changes in all your tags using your centering CSS code if you ever want to change the style.

This is what I ended up doing:
<div style="height: 600px">
<img src="assets/zzzzz.png" alt="Error" style="max-width: 100%;
max-height: 100%; display:block; margin:auto;" />
</div>
Which will limit the image height to 600px and will horizontally-center (or resize down if the parent width is smaller) to the parent container, maintaining proportions.

I am going to go out on a limb and say that the following is what you are after.
Note, the following I believe was accidentally omitted in the question (see comment):
<div id="thumbnailwrapper"> <!-- <<< This opening element -->
<div id="artiststhumbnail">
...
So what you need is:
#artiststhumbnail {
width:120px;
height:108px;
margin: 0 auto; /* <<< This line here. */
...
}
http://jsfiddle.net/userdude/XStjX/3/

yeah, the code like this work fine
<div>
<img/>
</div>
but just to remind u, the style for image
object-fit : *depend on u*
so the final code be like Example
div {
display: flex;
justify-content: center;
align-items: center;
}
div img {
object-fit: contain;
}
<div style="border: 1px solid red;">
<img src="https://img.joomcdn.net/9dd32cbfa0cdd7f48ca094972ca47727cd3cd82c_original.jpeg" alt="" srcset="" style="
border-radius: 50%;
height: 7.5rem;
width: 7.5rem;
object-fit: contain;" />
</div>

Add this to your CSS:
#artiststhumbnail a img {
display: block;
margin-left: auto;
margin-right: auto;
}
Just referencing a child element which in that case is the image.

To center an image horizontally, this works:
<p style="text-align:center"><img src=""></p>

Put the picture inside a newDiv.
Make the width of the containing div the same as the image.
Apply margin: 0 auto; to the newDiv.
That should center the div within the container.

Use positioning. The following worked for me... (Horizontally and Vertically Centered)
With zoom to the center of the image (image fills the div):
div{
display:block;
overflow:hidden;
width: 70px;
height: 70px;
position: relative;
}
div img{
min-width: 70px;
min-height: 70px;
max-width: 250%;
max-height: 250%;
top: -50%;
left: -50%;
bottom: -50%;
right: -50%;
position: absolute;
}
Without zoom to the center of the image (image does not fill the div):
div{
display:block;
overflow:hidden;
width: 100px;
height: 100px;
position: relative;
}
div img{
width: 70px;
height: 70px;
top: 50%;
left: 50%;
bottom: 50%;
right: 50%;
position: absolute;
}

Center a image in a div
/* standar */
div, .flexbox-div {
position: relative;
width: 100%;
height: 100px;
margin: 10px;
background-color: grey;
}
img {
border: 3px solid red;
width: 75px;
height: 75px;
}
/* || standar */
/* transform */
.transform {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%); /* IE 9 */
-webkit-transform: translate(-50%, -50%); /* Chrome, Safari, Opera */
}
/* || transform */
/* flexbox margin */
.flexbox-div {
display: -webkit-flex;
display: flex;
background-color: lightgrey;
}
.margin-img {
margin: auto;
}
/* || flexbox margin */
/* flexbox justify align */
.flexbox-justify {
justify-content: center;
}
.align-item {
align-self: center;
}
/* || flexbox justify align */
<h4>Using transform </h4>
<div>
<img class="transform" src="http://placeholders.org/250/000/fff" alt="Not By Design" border="1" />
</div>
<h4>Using flexbox margin</h4>
<div class="flexbox-div">
<img class="margin-img" src="http://placeholders.org/250/000/fff" alt="Not By Design" border="1" />
</div>
<h4>Using flexbox justify align</h4>
<div class="flexbox-div flexbox-justify">
<img class="align-item" src="http://placeholders.org/250/000/fff" alt="Not By Design" border="1" />
</div>

I have tried a few ways. But this way works perfectly for me
<img src="~/images/btn.png" class="img-responsive" id="hide" style="display: block; margin-left: auto; margin-right: auto;" />

Put an equal pixel padding for left and right:
<div id="artiststhumbnail" style="padding-left:ypx;padding-right:ypx">

A responsive way to center an image can be like this:
.center {
display: block;
margin: auto;
max-width: 100%;
max-height: 100%;
}

you can align your content using flex box with minimum code
HTML
<div class="image-container">
<img src="https://image.freepik.com/free-vector/modern-abstract-background_1048-1003.jpg" width="100px">
</div>
CSS
.image-container{
width:100%;
background:green;
display:flex;
.image-container{
width:100%;
background:green;
display:flex;
justify-content: center;
align-items:center;
}
<div class="image-container">
<img src="https://image.freepik.com/free-vector/modern-abstract-background_1048-1003.jpg" width="100px">
</div>
js fiddle link https://jsfiddle.net/7un6ku2m/

If you have to do this inline (such as when using an input box),
here is a quick hack that worked for me: surround your (image link in this case)
in a div with style="text-align:center"
<div style="text-align:center">
<a title="Example Image: Google Logo" href="https://www.google.com/"
target="_blank" rel="noopener"><img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="Google Logo. Click to visit Google.com" border="0" data-recalc-dims="1" /></a>
<h6><strong>This text will also be centered </strong></h6>
</div> /* ends centering style */

.document {
align-items: center;
background-color: hsl(229, 57%, 11%);
border-radius: 5px;
display: flex;
height: 40px;
width: 40px;
}
.document img {
display: block;
margin: auto;
}
<div class="document">
<img src="./images/icon-document.svg" alt="icon-document" />
</div>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body{
/*-------------------important for fluid images---\/--*/
overflow-x: hidden; /* some browsers shows it for mysterious reasons to me*/
overflow-y: scroll;
margin-left:0px;
margin-top:0px;
/*-------------------important for fluid images---/\--*/
}
.thirddiv{
float:left;
width:100vw;
height:100vh;
margin:0px;
background:olive;
}
.thirdclassclassone{
float:left; /*important*/
background:grey;
width:80vw;
height:80vh; /*match with img height bellow*/
margin-left:10vw; /* 100vw minus "width"/2 */
margin-right:10vw; /* 100vw minus "width"/2 */
margin-top:10vh;
}
.thirdclassclassone img{
position:relative; /*important*/
display: block; /*important*/
margin-left: auto; /*very important*/
margin-right: auto; /*very important*/
height:80vh; /*match with parent div above*/
/*--------------------------------
margin-top:5vh;
margin-bottom:5vh;
---------------------------------*/
/*---------------------set margins to match total height of parent di----------------------------------------*/
}
</style>
</head>
<body>
<div class="thirddiv">
<div class="thirdclassclassone">
<img src="ireland.png">
</div>
</body>
</html>

##Both Vertically and Horizontally center of the Page
.box{
width: 300px;
height: 300px;
background-color: #232532;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}

Style.css
img#center-img{
display: block;
margin: auto;
}
Html
<html>
<body>
<div>
<img src='pic.png' id='center-img'>
</div>
</body>
</html>

To center a image use this css. You have to give width at first of the image.
img{
width: 300px;
position: fixed;
left0;
right:0;
}

Related

div containing resized image, width are not resized to width of image

I have a div with a fixed position containing an image that I have set to max-width:20% so it is scaled down. The height of the div is scaled to match the image but the width isn't, it looks like it's the same width of the initial size of the image.
I might be missing something fundamental but can't really understand this.
#logo {
max-width: 20%;
}
#logoholder {
position: fixed;
left: 10px;
top: 120px;
background: rgb(47 47 47 / 36%);
text-align: center;
}
#logo2 {
max-width: 77px;
}
#logoholder2 {
position: fixed;
width: 77px;
height: 77px;
left: 10px;
top: 30px;
background: rgb(47 47 47 / 36%);
text-align: center;
}
<div id="logoholder">
<img id="logo" src="https://www.google.com/gmail/about/static-2.0/images/logo-gmail.png">
</div>
<-- Expected result -->
<div id="logoholder2">
<img id="logo2" src="https://www.google.com/gmail/about/static-2.0/images/logo-gmail.png">
</div>
#logo{
max-width:100px;
}
#logoholder {
position: fixed;
left:0;
top:0;
background: rgb(47 47 47 / 36%);
}
<div id="logoholder">
<img id="logo" src="https://www.google.com/gmail/about/static-2.0/images/logo-gmail.png">
</div>
The max-width using a percentage is causing weird behaviour, changed it to px.
I set some margins and borders for clarity - and left the original images in place (the first one is the one in play here)
I would suggest using a flex display for simplicity then we can set the container to a size and the height of the image to what we want relative to that (see comments in the CSS)
I set the button at the "top" but it could be relative position also and work around that "fixed" position issue.
body {
margin: 0;
}
#logoholder {
position: relative;
left: 10px;
top: 1rem;
/* background: rgb(47 47 47 / 36%);*/
/* light violet background */
background-color: #8080FF20;
}
#logo {
max-width: 20%;
}
#logoholder2 {
position: relative;
left: 10px;
top: 30px;
*/ width: 77px;
height: 77px;
/* light cyan background */
background-color: #20E0E020;
}
#logo2 {
max-width: 77px;
}
/* set up the blocks to keep the "gray" one at the top */
.container-all {
display: flex;
align-items: cemter;
justify-content: cemter;
/*stack then for this demo */
flex-direction: column;
/* the "lime" border around all the content */
border: solid 1px #88ff88;
}
.container-all .content-container {
margin: 0.5rem;
/* get our logo (first container) at the top if we want to */
/* margin-top:0;*/
}
.logo-container {
/* keep logo/button at top when scrolling for this demo */
align-self: flex-start;
position: sticky;
top: 0;
/* set up this containers display */
display: flex;
justify-content: center;
align-items: center;
}
.logo-container .content-item {
/* controls the height of the image on the button */
/* these should be the same since the "default" is 16px font-size == 1rem */
font-size: 1rem;
/* font-size:16px;*/
}
.logo-image {
/* controlled by container font size as these have em */
/* so if 1rem = 16px this 4em would be 16 X 5=80px */
height: 5em;
}
.content-container {
text-align: center;
border: 1px solid blue;
object-fit: contain;
}
.content-container:first-of-type {
/* light gray background for this demo */
/* alpha transparency information into the hex format for colors 2E as this has 8 characters */
background-color: #8080802E;
border: outset #D0D0D02E 4px;
}
.content-item {
border: dashed #00000044 1px;
padding: 0.25rem;
margin: 0.25rem;
}
.content-container .content-item .big-me:last-of-type {
height: 20rem;
}
<div class="container-all">
<div class="logo-container content-container">
<button type="button" class="content-item">
<img class="logo-image" src="https://www.google.com/gmail/about/static-2.0/images/logo-gmail.png">
</button>
</div>
<div class="content-container">
<div class="content-item">
Below here just to force scrolling on the sticky icon
</div>
</div>
<div id="logoholder" class="xcontent-container">
<div class="content-item">
<img id="logo" src="https://www.google.com/gmail/about/static-2.0/images/logo-gmail.png">
</div>
</div>
<div class="content-container">
<div class="content-item">
<-- Expected result -->
</div>
</div>
<div id="logoholder2" class="content-container">
<div class="content-item">
<img id="logo2" src="https://www.google.com/gmail/about/static-2.0/images/logo-gmail.png">
</div>
</div>
<div class="content-container">
<div class="content-item">
<div class="big-me">I am big so I can force the scroll.
</div>
</div>
</div>
</div>

Responsive CSS limiting images to half the screen, want to display them horizontally

I have manged to piece together enough html/css from sources online to almost be able to do what I want. I am trying to display n (currently 4) images with buttons in the center next to each other horizontally across the top of the page. I have the four images loading with a button in the middle. I have them surrounded by a box. I have them acting responsively to the size of the browser (within reason).
Unfortunately, for a reason that is unclear to me, the images will only spread about half way across the box:
Here is what I believe to be the relevant html:
<div id ="buttonWrapper">
<div class="container" id="position1">
<img src="images/originals/mountainclimber.jpg" alt="Mountain Climber">
<button class="btn" id="mountainHtmlButton">The Mountain Climber</button>
</div>
<div class="container" id="position2">
<img src="images/originals/fuchun.jpg" alt="Fuchun">
<button class="btn" id="fuchunHtmlButton">Dwelling in the Fuchun Mountains</button>
</div>
<div class="container" id="position3">
<img src="images/originals/palace.jpg" alt="Palace">
<button class="btn" id="palaceHtmlButton">Amailenborg Palace Square</button>
</div>
<div class="container" id="position3">
<img src="images/originals/udnie.jpg" alt="Udnie">
<button class="btn" id="udnieHtmlButton">Udnie</button>
</div>
</div>
And the corresponding relevant CSS:
/* Container needed to position the button. Adjust the width as needed */
.container {
position: relative;
width: 25%;
}
/* Make the image responsive */
.container img {
width: 100%;
height: auto;
}
/* Style the button and place it in the middle of the container/image */
.container .btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: #555;
color: white;
font-size: 16px;
padding: 12px 24px;
border: none;
cursor: pointer;
border-radius: 5px;
}
.container .btn:hover {
background-color: black;
}
/*
**********
Section for button alignment/positioning stuff
**********
*/
#buttonWrapper {
background-color: black;
border-radius: 10px;
}
#position1 {
float: left;
/*width: 25%; */
overflow: hidden;
}
#position2 {
overflow:hidden;
}
#position3 {
overflow:hidden;
}
#position4 {
overflow:hidden;
}
The only 50% references I see appear to be tied to the button placement. But I clearly do not fully understand what is happening here. Again, my ideal outcome here is that the 4 images are displayed side by side horizontally all the way across the black background (assuming the window size is something reasonable). I know that will still look slightly strange because of the different aspect ratios of the images.
thank you for any help
#buttonWrapper {
display:flex;
}
/* ↑ i added above code ↑ */
.container {
position: relative;
width: 25%;
}
/* Make the image responsive */
.container img {
width: 100%;
height: auto;
}
/* Style the button and place it in the middle of the container/image */
.container .btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: #555;
color: white;
font-size: 16px;
padding: 12px 24px;
border: none;
cursor: pointer;
border-radius: 5px;
}
.container .btn:hover {
background-color: black;
}
/*
**********
Section for button alignment/positioning stuff
**********
*/
#buttonWrapper {
background-color: black;
border-radius: 10px;
}
#position1 {
float: left;
/*width: 25%; */
overflow: hidden;
}
#position2 {
overflow:hidden;
}
#position3 {
overflow:hidden;
}
#position4 {
overflow:hidden;
}
<div id ="buttonWrapper">
<div class="container" id="position1">
<img src="https://picsum.photos/300/700" alt="Mountain Climber">
<button class="btn" id="mountainHtmlButton">The Mountain Climber</button>
</div>
<div class="container" id="position2">
<img src="https://picsum.photos/300/700" alt="Fuchun">
<button class="btn" id="fuchunHtmlButton">Dwelling in the Fuchun Mountains</button>
</div>
<div class="container" id="position3">
<img src="https://picsum.photos/300/700" alt="Palace">
<button class="btn" id="palaceHtmlButton">Amailenborg Palace Square</button>
</div>
<div class="container" id="position3">
<img src="https://picsum.photos/300/700" alt="Udnie">
<button class="btn" id="udnieHtmlButton">Udnie</button>
</div>
</div>
Follow this in your CSS.
Give your container float:left; width: 25%; and position:relative;
.container img { width: 100%; object-fit: cover; height: auto;}
last thing from your html , make correction in ID names. You can not repeat ID name, You have repeated position3 ID twice.

Keep 100% width inside an relative container?

I have something like this
<div class="container">
<div class="img-container">
<img class="thumbnail" src="https://via.placeholder.com/250x250" />
<div classe="img-icon-container">
<i class="photo-icon fas fa-camera-retro" />
<span>10</span>
</div>
</div>
</div>
.container{
height: 200px;
display: flex;
margin-bottom: 20px;
.img-container {
position: relative;
.thumbnail {
height: 100%;
}
.img-icon-container {
position: absolute;
bottom: 0;
width: 100%;
left: 0;
background-color: rgba(110, 110, 110, 0.8);
i {
margin-left: 5px;
margin-right: 5px;
font-size: 20px;
color: white;
}
&:hover {
background-color: blue;
}
}
}
}
In chrome it looks as I wanted.
but in IE 11 & FF
What do I need to add to keep the gray bar contained in the div?
Instead of width:100%; just add right:0;. This will always keep the edges of the inner box against the left and right sides.
The problem is the fixed height of the .container. If you have control of the sizing of these images I would just remove the fixed height of the .container and display: block; on the image to remove the spacing under it.
If you need it to accomodate varying aspect ratios then it's more complicated and there's never a perfect solution that looks neat.

Use img tag inside a div as the divs background image with text over

I have the following html:
<div class="article">
<img src="..." class="article-bg">
<h1 class="heading">Article Heading</h1>
<h2 class="author">Author Name</h2>
</div>
The article divs background image gets set dynamically, so setting the divs background in css is out, I have to use an image tag. I'm not too sure though how to use an img as the divs background, and at the same time have text over the img.
Also the height of the article div should always be 180px, I only have the following simple CSS:
.article {
height: 180px;
padding: 10px;
background-color: blue;
}
Thanks in advance for any tips!
You can do it by this way:
<div class="article">
<img src="http://www.bdembassyusa.org/uploads/images/beautiful-Bangladesh-23.jpg" class="article-bg">
<h1 class="heading">Article Heading</h1>
<h2 class="author">Author Name</h2>
</div>
Ad some more css below:
.article{
height: 180px;
padding: 10px;
background-color: blue;
overflow:hidden;
}
.article img{
position:absolute;
z-index:0;
width: 100%; // make the img fluid
height:200px;
margin:-10px;
object-fit: contain; // similar to `background-size: contain;`
}
.article h1,.article h2{
position:relative;
z-index:1;
}
Test it on jsfiddle:
http://jsfiddle.net/sarowerj/o9L72do0/
What you're looking for in z-index.
Using Z-index allows you to position one element above of the other. But do keep in mind that z-index does only work with positioned elements such as absolute or relative positioning.
You do specify a z-index as follows in the CSS:
.heading { position: absolute; top: 10px; left: 10px; z-index: 900; color: #fff; }
See this jsFiddle for a demo on how to use it:
You can use the CSS property object-fit for this.
However it is worth noting that this property has very little to no support on IE and Edge browser.
.conainer{
position: relative;
width: 500px;
height: 300px;
color: #ffffff;
overflow: hidden;
margin: auto;
}
.conainer img{
position: absolute;
top: 0;
left: 0;
transition: all 1s ease;
}
.conainer:hover img{
transform: scale(1.2);
}
.conainer .content{
position: relative;
z-index: 1;
}
.conainer .content h2{
color: white;
text-shadow: 3px 2px 10px #545454;
text-align: center;
}
<div class="conainer">
<div><img src="https://placeimg.com/640/480/nature" alt=""></div>
<div class="content">
<h2>Here's an example</h2>
</div>
</div>
You can use this code, to make <img> behave like a background image:
<img src="..." class="background-image" />
.background-image {
position: absolute;
z-index: -1;
min-width: 100%;
min-height: 100%;
left: 0;
top: 0;
pointer-events: none;
}
use
<div class="article" style="background: url(imageurl)">
</div>

centering div behind other divs- padding & margin not working

#home-slider should be perfectly centered behind all other divs within #home. margin and padding don't seem to work, as #home-slider remains at the top, left side of it's parent div. How else can I bring it down and centered? Or rather, what have I missed?
jsfiddle
live site
html
<!-- language: lang-html -->
<div id="home">
<div id="home-slider">
<img src="http://lorempixel.com/g/840/420" alt="home-slider" />
</div>
<div class="logo">
<h1><img src="http://lorempixel.com/232/232" alt="logo" id="logo" /></h1>
</div><!-- end logo -->
<div id="slider_mask">
<div class="slide_container">
<div class="slide"><p>is where creative <i>je ne sais quoi</i> + business savvy collide.</p></div>
<div class="slide"><p>is the maker + doer for makers + doers</p></div>
<div class="slide">
<ul>
<li>No items.</li> </ul>
</div>
</div>
<div class="left_button"></div>
<div class="right_button"></div>
</div>
</div><!-- end home -->
css
#home-slider {
top:0;
height:100%;
left:0;
position:fixed;
z-index:-9999;
}
#home .logo {
padding-top: 215px;
margin: 0 auto;
width: 232px;
}
#home #slider_mask {
width: 600px;
margin: 0 auto;
padding-top: 60px;
position: relative;
overflow: hidden;
}
#home #slider_mask .left_button {
float: left;
display: block;
width: 23px;
height: 25px;
background: url(img/left-arrow.png);
text-indent: -99999px;
}
#home #slider_mask .left_button:hover {
background: url(img/left-arrow-hover.png);
background-position: 0 0;
}
#home #slider_mask .slide_container {
float: left;
font-size: 120%;
text-align: center;
width: 300px;
}
#home #slider_mask .right_button {
float: right;
display: block;
width: 23px;
height: 25px;
background: url(img/right-arrow.png);
text-indent: -99999px;
}
#home #slider_mask .right_button:hover {
background: url(img/right-arrow-hover.png);
background-position: 0 0;
}
#home #slider_mask .slide {
float: left;
display: block;
text-align: center;
}
I understood you want #home-slider behind all others, and the others centered. Like adaam says "inline stylings on the HTML element defining the #home-slider div as having a relative position whilst in your CSS you had it set as absolute positioning. The inline had overrided the external stylesheet stylings"
I also added a few other css attributes here.
the HTML should be:
<div id="home-slider">
<img src="http://lorempixel.com/g/840/420" alt="home-slider" />
</div>
It's because you had inline stylings on the HTML element defining the #home-slider div as having a relative position whilst in your CSS you had it set as absolute positioning. The inline had overrided the external stylesheet stylings
Here is an updated fiddle: http://jsfiddle.net/dsZSE/10/
This is what your #home-slider code should look like:
#home-slider{
top:0;
height:100%;
left:0;
background-image:url('http://lorempixel.com/g/840/420');
background-repeat:no-repeat;
background-size:cover;
position:fixed;
z-index:-9999;
}