Solved

Why isn't this slideshow centered.

Posted on 2014-02-17
4
215 Views
Last Modified: 2014-02-17
Me again :)

Why isn't this slideshow centered?

Link to test site
I have this css:
div#centeringwidgekits {
    width: 100% ;
  margin-left: auto ;
  margin-right: auto ;
  
}
       

Open in new window


Thanks!

Rowby
0
Comment
Question by:Rowby Goren
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Adrian Crabtree
ID: 39866016
Hi rowby,

The width is set to 100%, so there is no room for margins. If you change the width to 600px (this matches what the content's width is), you should see the slider center.
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 39866055
Hi Adrian,

Sounds good.  But will it work  in a responsive display if I declare 600px, for example?

However if I have no choice, that is what I'll do.  Fortunately it is a module so I can unpublish it for use on cell phones, for example.

Rowby
0
 
LVL 8

Accepted Solution

by:
Adrian Crabtree earned 500 total points
ID: 39866074
You can set it to a max-width of 600px. CSS would look something like this:

div#centeringwidgekits {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    max-width: 600px;
}

Open in new window


Setting a max-width will allow it to be responsive since the width is still declared at 100%.
0
 
LVL 9

Author Closing Comment

by:Rowby Goren
ID: 39866084
Thanks!

That did the trick!  and thanks for the info regarding max-width.

Rowby
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question