Footer not responding to center commands - css

I'm making a very simple website and I've got a problem with my footer: it's not centering. I've done all the margin-left:auto; and right things, and the problem persists in Chrome and Firefox. The code:
#footer {
position: fixed;
z-index:10;
margin-left: auto;
margin-right: auto;
width: 1000px;
height:35px;
bottom:0px;
background-color:#363636;
/* Style info that has nothing to do with the problem below this line */
box-shadow: 1px -2px 6px rgba(0, 0, 0, 0.5);
-webkit-box-shadow:1px -2px 6px rgba(0, 0, 0, 0.5);
-moz-box-shadow:1px -2px 6px rgba(0, 0, 0, 0.5);
border-top-left-radius: 10px;
-moz-border-top-left-radius: 10px;
-webkit-border-top-left-radius: 10px;
border-top-right-radius: 10px;
-moz-border-top-right-radius: 10px;
-webkit-border-top-right-radius: 10px;
}
Already tried typing in "display:inline-block;".
The index.html code (ofc it's still in-dev, has nothing): http://d.pr/btSa
Thanks in advance.

The reason your footer is not centering with margin is because of the postion:fixed. Remove that and it will obey your margin auto's.
If you need it to be fixed, update your css to look like this:
#footer {
position: fixed;
z-index:10;
bottom:0;
left:50%;
margin-left: -500px;
width: 1000px;
height:35px;
bottom:0px;
background-color:#363636;
/* Style info that has nothing to do with the problem below this line */
}
note adding the bottom:0;, left:50%; and updating the margin properties.

I think you have a problem with the:
position: fixed
Try without it. If you want it stuck to the bottom try with other positions (absolute and etc). Try instead of with margin then to use left: auto and right: auto. since on fixed position i believe margins don't matter.
If you insist on it, try putting the footer as 100% width, make it fixed position and wherever you want it, then put the content in a wrapper inside the fixed footer and give that a margin: 0 auto. it will center inside the footer.

Try to use your footer in a table and set the alignment of td to center

Related

Can't center fixed form on unbounce platform

I'm working on the unbounce landing page platform. Overall, it's really awesome and makes A/B testing pretty easy. It's more or less just drag and drop, but you're able to add css, html, javascript, etc.
Anyway, I'm working on creating a fixed signup area on the bottom of the screen (should boost conversions), but I'm having some troubles. The signup box is created within the wysiwyg dashboard, and from what I see it just builds the CSS for you, as you move sliders, change colors and such.
I'm able to make the entire signup area float right to the bottom, but I can't get the signup box to stay centered. I can use margins and positioning, but not the align: center function.
I've tried doing margin-left: auto; margin-right: auto as well as text-align: center; but it does absolutely nothing!
When changing the size of the screen, it just will not stay centered. But here's the kicker; the text has no problem centering with just width: 100%.. The signup box doesn't seem to respect any wrapper and I'm thinking this might be the problem.
This is all the CSS I'm using to create this fixed section:
#lp-pom-box-214 {
top: auto !important;
display:block;
position:fixed;
margin-left: auto;
margin-right: auto;
bottom:0px;
width: 100%;
align: center;
}
#lp-pom-form-51 {
top: auto !important;
display:block;
width: 100%;
position:fixed;
bottom: 25px;
margin-left: 26%;
}
#lp-pom-text-211 {
top: auto !important;
display:block;
position:fixed;
bottom:75px;
width: 100%;
}
Thanks a TON in advance!! This client is really good to me, so I want to do a good job for them. I'm not a great coder, but I'm very good at marketing so feel free to give me a shout if you need help in that arena :) That's the best way I know how to give back to whoever helps me out (or anyone else in the community for that matter).
Thanks again.
You can't adjust the position of a fixed positioned element in this way.
A fixed position element is positioned relative to the viewport, or the browser window. The viewport doesn't change when the window is scrolled, so a fixed positioned element will do exactly as the name implies and remain fixed in it's assigned position. To position a fixed element you use the properties top, right, bottom, and left
If you want to keep it as a fixed positioned element you can vertically and horizontally center it on the page by setting top and left to 50% so as the left-top corner of the container is centered within the page, you can then use margin-top and margin-left with negative values to compensate for half of the width and height of the element to achieve true center within the center of your container.
Something like this?
if yes check this code
css
.fixed-bottom {
position:fixed;
left:0;
bottom:0;
padding:10px 0;
background:#CCC;
width:100%;
}
.fixed-bottom h1 {
text-align:center;
}
#lp-pom-button-52 {
display: block;
z-index: 61;
width: 175px;
height: 54px;
line-height: 54px;
behavior: url(/PIE.htc);
border-radius: 8px;
background-color: #ff0000;
background: -webkit-linear-gradient(#ff0000,#e60000);
background: -moz-linear-gradient(#ff0000,#e60000);
background: -ms-linear-gradient(#ff0000,#e60000);
background: -o-linear-gradient(#ff0000,#e60000);
background: linear-gradient(#ff0000,#e60000);
box-shadow: inset 0px 1px 0px #ff4c4c,inset 0 -1px 2px #b30000;
text-shadow: 1px 1px #5c0000;
-pie-background: linear-gradient(#ff0000,#e60000);
color: #fff;
border-style: solid;
border-width: 3px;
border-color: #333333;
font-size: 24px;
font-weight: bold;
font-family: arial;
text-align: center;
background-repeat: no-repeat;
float:left;
margin:0 0 0 10px;
}
#lp-pom-form-51 .lp-pom-form-field input[type=text] {
border-style: solid;
border-width: 10px;
border-color: #002c77;
}
a {
color: #ff0000;
text-decoration: none;
}

Fixed position of button in the middle of fixed page

my page has one big div with fixed width, like this:
#index_body{
width: 1010px;
background-image: url('images/main_bg_dark.png');
margin: auto;
overflow: hidden;
min-height: 50px;
padding-bottom: 10px;
border-radius: 7px;
-moz-box-shadow: 0 5px 15px #000000;
-webkit-box-shadow: 0 5px 15px #000000;
box-shadow: 0 5px 15px #000000;
}
I want to add button (20x20px) on the right side of page (vertically in the middle) - still next to index_body.
So the button has code, like this:
#butt {
width:20px;
height:20px;
background: url('images/scrollUp.png');
position:fixed;
top:50%;
left:WHAT SHOULD BE HERE??
}
Because it depends on actual resolution. My index_body is always centered. if I change resolution my button is moved to the left-right...
Instead of setting the left or right position, make sure the button element is inside the index element and then use a margin.
margin: 0px 0px 0px 1010px;
Here is a tested and working version with your code - http://lukewakeford.co.uk/testsite/blackbutton/
#butt {
width:20px;
height:20px;
background: url('images/scrollUp.png');
position:fixed;
top:50%;
right: 10%;
}
The 10% is an example, change to a percentage that looks good, and it should be responsive to screen resolution.
On the other hand, why would you want a fixed element INSIDE a fixed container? just make it absolute and float it to the right with a margin.
ok, it should be just like this:
#butt {
width:20px;
height:20px;
background: url('images/scrollUp.png');
position:fixed;
top:50%;
margin-left: 1010px;
}

CSS: Overlapping borders

I just stumbled on a problem where the shared border between a menu bar and the main content box does not go on properly (as the content box is too small)
Image: http://imgur.com/O3ra9
Code: http://jsfiddle.net/gh55e/2/
So I was wondering if there was a way to fix the border. Maybe by giving them both one and making it overlap? Just have no idea how to do this as margin -x doesn't work.
Give the right element a border all around, then use the margin-top and margin-left properties in the negatives to make them overlap. Here's an updated jsfiddle:
http://jsfiddle.net/gh55e/4/
CSS:
#right {
width: 85px;
float: right;
background-color: #e1e1e1;
padding: 0px 10px 10px 10px;
margin-top: -54px;
}
​
For later visitors, this is the CSS that eventually fixed it.
#right {
width: 385px;
float: right;
background-color: #e1e1e1;
padding: 0px 10px 10px 10px;
margin-left: -10px;
}
You basically make a margin of 10px and move it back for 10 px

Unwanted (img) side padding in IE

The problem only affects IE (Mine's 9) and as it's shown there are unwanted paddings on each side of the img tag.
Here's the CSS:
.imgclass {
position:relative;
top: 10px;
left: 60px;
border: 1px solid #666;
box-shadow: #666666 0px 0px 3px;
border-radius: 5px;
opacity: 0.9;
}
And so far I've tried img>padding 0& img>display>block & img>vertical-align.
Screenshot: http://i.stack.imgur.com/u2K4E.png
Thanks in advance
try adding the below to your imgclass in CSS
filter:alpha(opacity=90);
padding: 0;
and also check for padding in parent element
you can adde specifically that padding = 0
padding: 0;
also it would be good to know what class/attributes are applied to the div/element containing the image as if it is larger then padding may not be the issue? perhaps specify a specific width and height if you can to prevent css guessing.

Menu dropdowns need to be above the content, not move content down

Ok so I am really new to CSS and have been using it quite a bit daily to get desired effects on sites. I am working on a new menu, and I am using a preconfigured stack to show hidden content when the li is mouseover. The issue is that I want the dropdown to be on top of the existing content and not drop the content down to reveal the dropdown menus. I have achieved this on a full CSS menu, but this will not work here on this menu. My dropdowns are this;
.drop_6 {
width: 500px;
text-align:center;
padding: 4px 10px 4px 10px;
margin-right:30px;
margin-top:7px;
border:none;
position: relative;
top: -18px;
right: -370px;
/* Rounded Corners */
-moz-border-radius: 0px 5px 5px 5px;
-webkit-border-radius: 0px 5px 5px 5px;
border-radius: 0px 5px 5px 5px;
/* Background color and gradients */
background: #b5f0ff;
background: -moz-linear-gradient(top, #b5f0ff, #009fc6);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#b5f0ff), to(#009fc6));
}
I tried making these absolute and the main content relative, but the jquery in this stack just does not like that at all, and I get no effect at all. Here is a link to the mockup; http://testserver1.justrightwebdesign.com/
Get rid of overflow: hidden (.stacks_out, .stacks_top).
Add position: absolute (.shell)
Add z-index: 1 (.shell)
Your problem is that you set overflow:hidden to many of the parent elements. Remove those and you should at least see some effects. Then apply position:absolute to the drop_X Elements and move them to the correct position with the top and left-attribues. You can also remove the margins since you can position them freely.
Take a look at the z-index property in css.

Resources