css3, cannot put a div centralized - html

I cannot put my menu in the center of the page, i've inserted all "margin: 0 auto;" i can and all "text-align: center", and the div is separated from everything, is not a child of something else..
here's the css code:
.more{
margin: 0 auto;
position:relative;
clear:both;
font-size: 13px;
padding: 20px 0px;
text-transform: uppercase;
width: 40%;
height: 20%;
}
.more ul{
display:block;
text-align:center;
}
.more ul li{
display: block;
padding: 10px 3px;
float:left;
}
.more ul li.selected a,
.more ul li.selected a:hover{
background:#0099c5;
color:#fff;
text-shadow:none;
font-weight:bold;
}
.more ul li a{
color:#555;
float:left;
background:#fff;
width: 100%;
padding: 8px 10px;
-moz-box-shadow:1px 1px 2px #aaa;
-webkit-box-shadow:1px 1px 2px #aaa;
box-shadow:1px 1px 2px #aaa;
}
.more ul li a:hover{
background:#000;
color:#fff;
}
And here's the HTML code:
<div class="more">
<ul>
<li class="selected">Homepage Blog</li>
<li>Cerca</li>
<li>Archivio</li>
<li>Tags</li>
</ul>
</div>
How-to make the div permanently in the center of my page? I've tried lot, lot, lot of possible moves.
Thank you.
p.s. I've also tried to put a <div align=center> ...my menu (class=more) list ...</div>

Remember that you can't use margin:0 auto on floatted element.
Keys for margin 0 auto are:
1) element must have display:block
2) no float, absolute or fixed position
.more{
float:left;
clear:both;
font-size: 13px;
padding: 20px 0px;
text-transform: uppercase;
width: 100%;
height: 20%;
}
.more ul{
display:block;
text-align:center;
margin:0 auto;
}
.more ul li{
display: inline-block;
padding: 10px 3px;
}
.more ul li.selected a,
.more ul li.selected a:hover{
background:#0099c5;
color:#fff;
text-shadow:none;
font-weight:bold;
}
.more ul li a{
color:#555;
background:#fff;
width: 100%;
padding: 8px 10px;
-moz-box-shadow:1px 1px 2px #aaa;
-webkit-box-shadow:1px 1px 2px #aaa;
box-shadow:1px 1px 2px #aaa;
}
.more ul li a:hover{
background:#000;
color:#fff;
}

Related

align center and center tag are not working

i am trying to show pagination in center but its show on left side. i am also try center tag and align=center attributes but its not working....
Pagination show in the center of page
#pagination {
margin: 40 40 0;
float: left;
}
ul.tsc_pagination li a {
border:solid 1px;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
padding:6px 9px 6px 9px;
}
ul.tsc_pagination li {
padding-bottom:1px;
}
ul.tsc_pagination li a:hover,
ul.tsc_pagination li a.current {
color:#FFFFFF;
box-shadow:0px 1px #EDEDED;
-moz-box-shadow:0px 1px #EDEDED;
-webkit-box-shadow:0px 1px #EDEDED;
}
ul.tsc_pagination {
margin:4px 0;
padding:0px;
height:100%;
overflow:hidden;
font:12px 'Tahoma';
list-style-type:none;
}
ul.tsc_pagination li {
float:left;
margin:0px;
padding:0px;
margin-left:5px;
}
ul.tsc_pagination li a {
color:black;
display:block;
text-decoration:none;
padding:7px 10px 7px 10px;
}
ul.tsc_pagination li a img {
border:none;
}
ul.tsc_pagination li a {
color:#0A7EC5;
border-color:#8DC5E6;
background:#F8FCFF;
}
ul.tsc_pagination li a:hover,
ul.tsc_pagination li a.current {
text-shadow:0px 1px #388DBE;
border-color:#3390CA;
background:#58B0E7;
background:-moz-linear-gradient(top, #B4F6FF 1px, #63D0FE 1px, #58B0E7);
background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #B4F6FF), color-stop(0.02, #63D0FE), color-stop(1, #58B0E7));
}
<div id="pagination">
<ul class="tsc_pagination">
<!-- Show pagination links -->
<li></li>
<li><a class="current">1</a></li>
<li>2</li>
<li>Next</li>
<li></li>
</ul>
</div>
you can see this
Remove Float:left from li and add display:inline-block
#pagination{
margin: 40 40 0;
float: left;
width:100%;
}
ul.tsc_pagination li a{
border:solid 1px;
border-radius:3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
padding:6px 9px 6px 9px;
}
ul.tsc_pagination li{
padding-bottom:1px;
}
ul.tsc_pagination li a:hover,
ul.tsc_pagination li a.current{
color:#FFFFFF;
box-shadow:0px 1px #EDEDED;
-moz-box-shadow:0px 1px #EDEDED;
-webkit-box-shadow:0px 1px #EDEDED;
}
ul.tsc_pagination{
margin:4px 0;
padding:0px;
height:100%;
overflow:hidden;
font:12px 'Tahoma';
list-style-type:none;
text-align:center;
}
ul.tsc_pagination li{
display:inline-block;
margin:0px;
padding:0px;
margin-left:5px;
}
ul.tsc_pagination li a{
color:black;
display:block;
text-decoration:none;
padding:7px 10px 7px 10px;
}
ul.tsc_pagination li a img{
border:none;
}
ul.tsc_pagination li a{
color:#0A7EC5;
border-color:#8DC5E6;
background:#F8FCFF;
}
ul.tsc_pagination li a:hover,
ul.tsc_pagination li a.current{
text-shadow:0px 1px #388DBE;
border-color:#3390CA;
background:#58B0E7;
background:-moz-linear-gradient(top, #B4F6FF 1px, #63D0FE 1px, #58B0E7);
background:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #B4F6FF), color-stop(0.02, #63D0FE), color-stop(1, #58B0E7));
}
<div id="pagination">
<ul class="tsc_pagination">
<!-- Show pagination links -->
<li></li>
<li><a class="current">1</a></li>
<li>2</li>
<li>Next</li>
<li></li>
</ul>
</div>
There are 2 changes to make.
Change 1- Change css of #pagination to below.
#pagination {
width: 100%;
text-align: center;
}
Change 2- Make the ul.tsc_pagination li not have float instead of
that use display:inline-block. Change css as below.
ul.tsc_pagination li {
/* float: left;*/
/*Dont use float:left*/
display: inline-block;
margin: 0px;
padding: 0px;
margin-left: 5px;
}
#pagination {
width: 100%;
text-align: center;
}
ul.tsc_pagination li a {
border: solid 1px;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
padding: 6px 9px 6px 9px;
}
ul.tsc_pagination li {
padding-bottom: 1px;
}
ul.tsc_pagination li a:hover,
ul.tsc_pagination li a.current {
color: #FFFFFF;
box-shadow: 0px 1px #EDEDED;
-moz-box-shadow: 0px 1px #EDEDED;
-webkit-box-shadow: 0px 1px #EDEDED;
}
ul.tsc_pagination {
margin: 4px 0;
padding: 0px;
height: 100%;
overflow: hidden;
font: 12px 'Tahoma';
list-style-type: none;
}
ul.tsc_pagination li {
/* float: left;*/
/*Dont use float:left*/
display: inline-block;
margin: 0px;
padding: 0px;
margin-left: 5px;
}
ul.tsc_pagination li a {
color: black;
display: block;
text-decoration: none;
padding: 7px 10px 7px 10px;
}
ul.tsc_pagination li a img {
border: none;
}
ul.tsc_pagination li a {
color: #0A7EC5;
border-color: #8DC5E6;
background: #F8FCFF;
}
ul.tsc_pagination li a:hover,
ul.tsc_pagination li a.current {
text-shadow: 0px 1px #388DBE;
border-color: #3390CA;
background: #58B0E7;
background: -moz-linear-gradient(top, #B4F6FF 1px, #63D0FE 1px, #58B0E7);
background: -webkit-gradient(linear, 0 0, 0 100%, color-stop(0.02, #B4F6FF), color-stop(0.02, #63D0FE), color-stop(1, #58B0E7));
}
<div id="pagination">
<ul class="tsc_pagination">
<!-- Show pagination links -->
<li></li>
<li><a class="current">1</a></li>
<li>2</li>
<li>Next</li>
<li></li>
</ul>
</div>
try this one https://jsfiddle.net/g3643p4q/4/
only mansion
ul.tsc_pagination li {
display: inline-block;
float: none;
margin: 0 0 0 5px;
padding: 0;
}
ul.tsc_pagination {
font: 12px "Tahoma";
height: 100%;
list-style-type: none;
margin: 0 auto;
overflow: hidden;
padding: 0;
text-align: center;
}
#pagination {
float: none;
}

Remove padding from ul in css

I have a simple horizontal list menu that was working fine when I had a global (*) setting of padding: 0. For other reasons, I needed to take out that padding as a global setting, but I can't figure out how to make it apply to the list.
Now, each entry in the list has a blank block of maybe half an inch to the left of the first entry. If I can get rid of that, I'll be set. Here is a fiddle (http://jsfiddle.net/eha77way/), and I'll paste the code.
Thank you!
CSS
* {
border:0;
margin:0;
}
/* navigation */
#navigation, #episodenav, #pivotnav {
border-top:3px solid #FFF;
border-right:1px solid #FFF;
margin:0 auto;
list-style:none;
}
#pivotnav {
background:#F0F0F0;
border-top:3px solid #FFF;
border-right:1px solid #FFF;
margin:0 auto;
width:755px;
height:25px;
list-style:none;
}
#navigation {
background:#E0E0E0;
width:755px;
height:40px;
}
#episodenav {
width:756px;
background:#F0F0F0;
height:25px;
}
#pivotnav {
width:755px;
background:#F0F0F0;
height:25px;
}
#navigation li, #episodenav li, #pivotnav li {
border-left:1px solid #FFF;
float:left;
list-style:none;
}
#navigation li, #pivotnav li {
width:150px;
}
#episodenav li {
width:41px;
}
#navigation a, #episodenav a, #pivotnav a {
color:#000;
display:block;
text-align:center;
}
#navigation a {
line-height:40px;
}
#episodenav a, #pivotnav a {
line-height:25px;
}
/* content */
#content {
height:auto;
margin:50px auto;
position: relative;
padding:30px;
width:751px;
background: white;
-moz-box-shadow: 0 0 20px black;
-webkit-box-shadow: 0 0 20px black;
box-shadow: 0 0 20px black;
font-family: ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif;
}
#content h1 {
border-bottom:1px dashed #999;
font-size:2em;
padding:25px 5px;
font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
}
#content h2 {
font-size:1.6em;
padding:25px 5px;
font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
}
#content h3 {
font-size:1.1em;
padding:20px 5px;
font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
}
#content p {
padding: 10px 5px;
line-height: 21px;
}
#content textarea {
border: 1px solid #cccccc;
}
#list {
margin-left: 50px;
}
HTML
<body>
<div id="content">
<div id="navigation">
<ul>
<li><i>Ulysses</i> by Episode</a></li>
<li>Pivot Points</a></li>
<li>Projects</a></li>
<li>Collections</a></li>
<li>About Ashplant</a></li>
</ul>
</div>
<h2>TEST</h2>
</div>
</body>
</html>
Is this what you mean?
#navigation ul{
padding: 0;
}
The padding is in the ul element, not the lis. This is a default of the browser, that is much needed when bullets are visible.
You can add a css rule-set such as:
#navigation ul {
padding: 0;
}
at least on my jsbin, this does the trick.
Maybe you want to remove padding-left without {padding-left:0px}?
Please use it
ul > li {position: relative; left: -20px;}

Wordpress: Floating sidebar to right not working correctly

http://www.guytgunterappliances.com/product-category/shop/
My #container is currently at width:980px and my side has positioned itself to the bottom of the container div. Im trying to float it to the right of my container div. I have reduced the width of the container to 710px to fit the 270px sidebar then i float the sidebar. As you can see in the image, it stretches the sidebar.It runs over the container div as well.
SIDEBAR
*************************************************************************/
#sidebar{
position:relative;
z-index:10;
width:270px;
display:;
}
#sidebar,
#sidebar a,
#sidebar li,
#sidebar ul,
#sidebar ol{
color:#787878;
font-size:12px;
display:;
}
#sidebar a:hover{
}
#sidebar ul{
list-style:none;
padding:0;
margin:0;
}
#sidebar ul li.widget{
margin:0 0 0px 0;
border:1px solid #fff;
background: #e6e6e6;
}
#sidebar ul li.widget h2{
font-size:18px;
padding:13px 18px;
color:#45494e;
font-style:normal;
border:1px solid #cecece;
border-bottom:1px solid #fff;
}
#sidebar ul li ul{
border:1px solid #cecece;
border-bottom:none;
}
#sidebar ul li ul li{
border-bottom:1px solid #cecece;
padding: 10px 18px;
}
#sidebar ul li ul li:hover{
border-bottom:1px solid #cecece;
padding: 10px 18px;
background:#eee;
}
#sidebar ul li ul li ul{
padding:0 0 0 15px;
border:none;
}
#sidebar ul li ul li ul li{
border-bottom:none;
}
/* TEXT WIDGET */
#sidebar ul li div.textwidget{
padding: 10px 18px;
line-height:1.4em;
border:1px solid #cecece;
}
/* TAG CLOUD */
#sidebar ul li.widget_tag_cloud div{
padding: 10px 18px;
border:1px solid #cecece;
}
#sidebar ul li.widget_tag_cloud div a{
margin:0 10px 0 0;
}
/* CALENDAR */
#sidebar ul li.widget_calendar{
border:1px solid #fff;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar{
padding: 10px 18px;
width:100%;
border:1px solid #cecece;
border-top:none;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar a{
text-decoration: underline;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar caption{
padding: 5px 18px 0 18px;
border:1px solid #cecece;
border-bottom:none;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar tr td#next{
text-align:right;
}
/************************************************************************
# SIDEBAR END
There are few steps required to fix that issue:
you have two divs with id container on main page, the inner one and the outer one. Change id of one of those.
for the inner #container, add:
width: 710px;
float: left;
reduce width of #content and iframe to 710px or less.
finally, style #sidebar as #KaronatoR suggests:
width:270px;
display: block;
float: left;
Try so:
#sidebar {
width:270px;
display: block;
dloat: left;
}

Wordpress sidebar positioned under content - CSS

My sidebar in working with woocommerce is positioned under my content div. when i shrink the content div to 710px and try to float:right the sidebar... it doesn't want to float correctly.
SUBJECT SITE
Any help would be appreciated.
# SIDEBAR
*************************************************************************/
#sidebar{
position:relative;
z-index:10;
width:270px;
display:;
}
#sidebar,
#sidebar a,
#sidebar li,
#sidebar ul,
#sidebar ol{
color:#787878;
font-size:12px;
display:;
}
#sidebar a:hover{
}
#sidebar ul{
list-style:none;
padding:0;
margin:0;
}
#sidebar ul li.widget{
margin:0 0 0px 0;
border:1px solid #fff;
background: #e6e6e6;
}
#sidebar ul li.widget h2{
font-size:18px;
padding:13px 18px;
color:#45494e;
font-style:normal;
border:1px solid #cecece;
border-bottom:1px solid #fff;
}
#sidebar ul li ul{
border:1px solid #cecece;
border-bottom:none;
}
#sidebar ul li ul li{
border-bottom:1px solid #cecece;
padding: 10px 18px;
}
#sidebar ul li ul li:hover{
border-bottom:1px solid #cecece;
padding: 10px 18px;
background:#eee;
}
#sidebar ul li ul li ul{
padding:0 0 0 15px;
border:none;
}
#sidebar ul li ul li ul li{
border-bottom:none;
}
/* TEXT WIDGET */
#sidebar ul li div.textwidget{
padding: 10px 18px;
line-height:1.4em;
border:1px solid #cecece;
}
/* TAG CLOUD */
#sidebar ul li.widget_tag_cloud div{
padding: 10px 18px;
border:1px solid #cecece;
}
#sidebar ul li.widget_tag_cloud div a{
margin:0 10px 0 0;
}
/* CALENDAR */
#sidebar ul li.widget_calendar{
border:1px solid #fff;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar{
padding: 10px 18px;
width:100%;
border:1px solid #cecece;
border-top:none;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar a{
text-decoration: underline;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar caption{
padding: 5px 18px 0 18px;
border:1px solid #cecece;
border-bottom:none;
}
#sidebar ul li.widget_calendar #calendar_wrap table#wp-calendar tr td#next{
text-align:right;
}
/************************************************************************
# SIDEBAR END
You have two divs with id="container" that means that anything you pass to #container in your css it will only be applied to the first one. So you should take this div #wrapper-containter #wrapper #container change it's id, and then apply the width to it and then float around whatever you need.

Centering a <ul> using CSS

I have some navigation links at the top of the page that I am having trouble placing in the centre of the screen. Can anybody suggest where I'm going wrong in the CSS?
Image:
http://i.imgur.com/SUTWr.png
Here's the CSS:
#nav {
list-style-type:none;
text-align:center
}
ul li {
display:inline-block;
border-radius:10px;
background:#EEE;
margin:5px;
}
li a {
float:left;
padding:30px;
text-decoration:none;
color:black;
text-shadow: 1px 1px #DDD;
border-radius:10px;
box-shadow:3px 3px black;
}
li a:hover {
background:#CCC;
color:#333;
}
li a:active {
background:#555;
color:white;
text-shadow: 1px 1px #000;
}
Thanks
Hi actually i have updated your css now i hope this work will for you :-
DEMO
CSS
#nav {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background: none repeat scroll 0 0 #B8B8B8;
height: 400px;
list-style-type: none;
margin: auto;
padding: 40px 0;
width: 400px;
}
ul li {
display:inline;
}
li a {
text-decoration:none;
color:black;
text-shadow: 1px 1px #DDD;
border-radius:10px;
background:#EEE;
margin:5px;
padding:30px;
box-shadow:3px 3px black;
}
li a:hover {
background:#CCC;
color:#333;
}
li a:active {
background:#555;
color:white;
text-shadow: 1px 1px #000;
}
Here's a quick demo of how to center a UL: http://jsfiddle.net/73Mum/1/
<div class="wrap">
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
<li>five</li>
</ul>
</div>
.wrap {
text-align:center;
background:#999;
padding:100px 0;
}
ul {
width:500px;
margin:0 auto;
}
ul li {
display:inline-block;
padding:10px;
background:#ccc;
}
Try wrapping these <ul>-tags with a <div style="margin-left: auto; margin-right: auto">.
This way you center all <ul>-tags at once.
If "1,2,3,4,5" in your picture are the ul-elements and #nav is the id of your surrounding div, you can just add margin-left: auto; margin-right: auto to #nav in your stylesheet.