<span> elements inside a slider that are impossible to center? - css

.nivo-controlNav does center itself inside the slider, but i can't get to center .nivo-controlNav span inside .nivo-controlNav.
code inspector:
.nivo-controlNav {
margin: 0 auto;
text-align: center;
width: 200px;
}
.nivo-controlNav span {
text-align: center;
}
.nivo-controlNav a {
display: block;
float: left;
width: 22px;
height: 22px;
background: url(images/bullets.png) no-repeat;
text-indent: -9999px;
border: 0;
margin-right: 3px;
margin: 0 auto;
}
.nivo-controlNav a.active {
background-position: 0 -22px;
}
.nivo-directionNav a {
display: block;
width: 30px;
height: 30px;
background: url(images/arrows.png) no-repeat;
text-indent: -9999px;
border: 0;
}
a.nivo-nextNav {
background-position: -30px 0;
right: 15px;
}
a.nivo-prevNav {
left: 15px;
}
.nivo-caption {
text-shadow:none;
font-family: Helvetica, Arial, sans-serif;
}
.nivo-caption a {
color:#efe9d1;
text-decoration:underline;
}
.shadow-top {
height: 10px;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#111), to(#333));
background: -moz-linear-gradient(#111, #333);
-pie-background: linear-gradient(#111, #333);
}
.shadow-bottom {
height: 10px;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#333), to(#111));
background: -moz-linear-gradient(#333, #111);
-pie-background: linear-gradient(#333, #111);
}
.shadow-slider {
margin: 0 auto;
overflow: hidden;
width: 940px;
height: 10px;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#999), to(#FFF));
background: -moz-linear-gradient(#999, #DDD);
-pie-background: linear-gradient(#222, #000);
}
#slider img {
float: left;
width: 958px;
height: 458px;
}
EDIT:
(I managed to center the div, but now .nivo-controlNav a loses its width and height because is not floating left).
How to solve this?
#slider-wrapper {
float: left;
height: 500px;
}
#slider {
float: left;
border: 1px solid #DDD;
position:relative;
background:url(images/loading.gif) no-repeat 50% 50%;
}
#slider img {
position:absolute;
top: 0px;
left: 0px;
display: none;
}
.nivo-controlNav {
margin: 480px auto 0;
overflow: hidden;
text-align: center;
width: 200px;
}
.nivo-controlNav span {
}
.nivo-controlNav a {
width: 22px;
height: 22px;
background: url(images/bullets.png) no-repeat;
text-indent: -9999px;
border: 0;
margin-right: 3px;
}
.nivo-controlNav a.active {
background-position: 0 -22px;
}
.nivo-directionNav a {
display: block;
width: 30px;
height: 30px;
background: url(images/arrows.png) no-repeat;
text-indent: -9999px;
border: 0;
}
a.nivo-nextNav {
background-position: -30px 0;
right: 15px;
}
a.nivo-prevNav {
left: 15px;
}
.nivo-caption {
text-shadow:none;
font-family: Helvetica, Arial, sans-serif;
}
.nivo-caption a {
color:#efe9d1;
text-decoration:underline;
}

I think you can achieve that by just using:
.nivo-controlNav span {
display: inline-block;
}
I would also remove the float:left from the link as that can cause problems. You do need display:block on the link in order to be able to give it a width.

You have a CSS class for .nivo-controlNav a set to float: left; which is likely overriding your text-align: center on the class .nivo-controlNav span
EDIT: To accomplish what you're after, try replacing your span elements with one parent ul and an li element where you have the spans now. Then add the following to your CSS and continue using float: left on your a elements.
.nivo-controlNav li {
text-align: center;
list-style: none;
}
Let me know if this isn't clear and I'll try to setup an example.

Related

Media query not working without !important

My media query does not override the regular CSS unless I use !important all the time. What's the error? Here you can see the CSS with the !importants. If I remove them, the styling goes back to the regular CSS, even when the screen is less than 850px. Could you please help?
#media all and (min-width: 200px) and (max-width: 850px) {
html body {
position: absolute;
height: 100%;
width: 100% !important;
margin: 0 auto;
text-align:center;
}
#header {
background-color: white;
position: fixed;
top: 0px;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
width: 95%;
height: 120px;
z-index:9999;
}
#header-inner{
width: 100% !important;
float: right;
}
div#title {
margin: 0px !important;
position: absolute;
width: 100% !important;
height: 70px;
background: url('mobillogo.png');
background-repeat: no-repeat;
background-size: auto 70px;
}
.wrapper {
width: 100% !important;
overflow:auto;
margin-left: auto;
margin-right: auto;
}
#first {
padding-top: 150px;
padding-bottom: 30px;
overflow:auto;
width: 95%;
background-color: #f7fdff;
height: ;
}
#second {
margin-top: 65px;
overflow: auto;
width: 95% !important;
margin-bottom: 65px;
background-color: white;
}
#third {
overflow:auto;
width: 95% !important;
background-color: #f3efef;
padding-bottom: 4em;
}
#footer
{
height: 115px;
width:100% !important;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
background-color: white;
padding-top: 1em;
padding-bottom: 0.5em;
}
#footbox {
height: 70px;
width: 100% !important;
margin-top: 0px;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
}
#contains {
width: 100% !important;
margin-top: 50px;
}
h1 {
float: left;
width: 100% !important;
margin-top: 2em;
font-family: Jersey;
font-size: 3.5em;
text-align: center;
color: #f44336;
}
#logo {
margin-top:70px !important;
width: 100% !important;
height: 70px;
}
div#logo img {
position: static !important;
height: 13vw !important;
}
#footbox {
height: 70px;
width: 95%;
margin-top: 0px;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
}
#checklist {
overflow: auto;
position: relative;
float: left;
width: 100% !important;
font-family: 'Open Sans', sans-serif;
padding-bottom: 8vh;
padding-top: 15px;
text-align:left;
}
#short {
width: 100% !important;
color: black;
font-weight: bold;
font-size: 1.3em;
margin: 0px !important;
}
#form {
overflow: auto;
border-radius: 5px;
padding: 0px !important;
position: relative;
width: 100% !important;
display: inline-block;
-webkit-transition:background 0.3s;
-moz-transition:background 0.3s;
-o-transition:background 0.3s;
transition:background 0.3s;
transition-timing-function: ease-in-out;
}
ul.inline {
width: 100% !important;
list-style-type: none;
columns: 1 !important;
-webkit-columns: 1 !important;
-moz-columns: 1 !important;
list-style-position: inside;
padding: 0px;
margin: 0px;
}
#fulltext {
width: 90%;
padding-right: 30px;
}
.text {
width: 75% !important;
}
}
html body {
position: absolute;
height: 100%;
width: 100%;
margin: 0 auto;
text-align:center;
}
#font-face {
font-family: Jersey; src: url('Jersey M54.ttf');
}
p {
font-family: 'Open Sans', sans-serif;
text-align:left;
}
.lightup {
background-color: #ffc107;
}
button {
float: right;
margin-right: 10px;
font-size: 1.2em;
background: #5fbd5f;
color: white;
padding: 5px;
font-family: 'Open Sans', sans-serif;
color: white;
padding: 5px;
padding-left: 10px;
padding-right: 10px;
border: 0;
outline: none;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
button:hover {
cursor: pointer;
cursor: hand;
}
button:active{
border: 0;
outline: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);ű
}
a, u {
text-decoration: none;
}
#header-inner{
width: 1100px;
float: right;
}
#header {
background-color: white;
position: fixed;
top: 0px;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
width: 100%;
height: 120px;
z-index:9999;
}
.wrapper {
overflow:auto;
width: 1100px;
margin-left: auto;
margin-right: auto;
}
#first {
padding-top: 150px;
padding-bottom: 30px;
overflow:auto;
width: 100%;
background-color: #f7fdff;
height: ;
}
#second {
margin-top: 65px;
overflow: auto;
width: 100%;
margin-bottom: 65px;
background-color: white;
}
#third
{
overflow:auto;
width: 100%;
background-color: #f3efef;
padding-bottom: 4em;
}
#footer
{
height: 115px;
width:100%;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
background-color: white;
padding-top: 1em;
padding-bottom: 0.5em;
}
#footbox {
height: 70px;
width: 1100px;
margin-top: 0px;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
}
#contains {
width: 100%;
margin-top: 50px;
}
#toTop {
clear:both;
width: 600px;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
font-family: 'Bree Serif', serif;
color: white;
border-radius: 5px;
background: #f44336;
padding-left: 15px;
padding-right: 15px;
font-size: 70px;
}
#logo {
float:left;
margin-top:1em;
}
h1 {
position: relative;
vertical-align: text-top;
margin-top: -12px;
font-family: Jersey;
font-size: 3.5em;
text-align: right;
color: #f44336;
}
h4 {
margin-top: 0px;
margin-bottom: 0;
font-family: Jersey;
font-size: 2em;
text-align: center;
color: white;
}
h5 {
position:relative;
float:left;
font-family: 'Open Sans', sans-serif;
color: #f44336;
font-size: 37px;
padding:5px;
width:250px;
margin-top: -15px;
margin-bottom: 0px;
margin-left: auto;
margin-right: auto;
text-align: right;
}
#purple {
text-align: center;
vertical-align: middle;
margin-top: 10px;
position:relative;
padding-right: 15px;
}
.caltxt {
padding-top: 0px;
padding-left: 15px;
font-size: 1em;
color: white;
}
#calendar {
margin-bottom: 5em;
margin-left: 80px;
float: left;
width: 600px;
height: 400px;
}
#sept {
float: left;
position: relative;
width: 25%;
height: 100%;
background-color: #4caf50;
}
#oct {
float: left;
position: relative;
width: 25%;
height: 75%;
background-color: #f44336;
}
#nov {
float: left;
position: relative;
width: 25%;
height: 75%;
background-color: #266fea;
}
#dec {
float: left;
position: relative;
width: 25%;
height: 75%;
background-color: #ffc107;
}
#plus {
float: left;
position: relative;
width: 75%;
height: 25%;
background-color: #9c27b0;
z-index: 0;
}
.calendar {
-webkit-transition: all 250ms;
-moz-transition: all 250ms;
transition: all 250ms;
}
.calendar:hover {
z-index: 9998;
box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
-webkit-transform: translateY(-5px);
-moz-transform: translateY(-5px);
transform: translateY(-5px);
}
div#title {
margin-top: 50px;
position: absolute;
width: 1100px;
height: 70px;
background: url('weblogo.png');
background-repeat: no-repeat;
background-position: 0px;
background-size: auto 70px;
}
#checklist {
overflow: auto;
position: relative;
float: left;
width: 750px;
font-family: 'Open Sans', sans-serif;
padding-bottom: 8vh;
padding-top: 15px;
text-align:left;
}
#short {
width: 750px;
color: black;
font-weight: bold;
font-size: 1.3em;
}
#form {
overflow: auto;
border-radius: 5px;
padding: 15px;
position: relative;
width: 260px;
display: inline-block;
-webkit-transition:background 0.3s;
-moz-transition:background 0.3s;
-o-transition:background 0.3s;
transition:background 0.3s;
transition-timing-function: ease-in-out;
}
.text {
width: 90%;
text-align: left;
padding: 5px;
margin-top: 0px;
margin-bottom: 5px;
font-family: 'Open Sans', sans-serif;
border: 1px solid grey;
border-radius: 5px;
}
#fulltext {
width: 90%;
padding-right: 30px;
}
#name {
background: url(profile.png) no-repeat scroll 5px 5px;
background-color: white;
background-size: 20px;
margin-top: auto;
margin-bottom: auto;
padding-left:30px;
margin-bottom: 10px;
}
#email {
background: url(message.png) no-repeat scroll 5px 8px;
background-color: white;
background-size: 20px;
margin-top: auto;
margin-bottom: auto;
padding-left:30px;
margin-bottom: 10px;
}
#university {
background: url(university.png) no-repeat scroll 5px 4px;
background-color: white;
background-size: 20px;
margin-top: auto;
margin-bottom: auto;
padding-left:30px;
margin-bottom: 10px;
}
h3 {
font-family: 'Bree Serif', serif;
width: 130px;
color: white;
border-radius: 5px;
background: #f44336;
padding: 5px;
}
#textbox{
width: 90%;
height: 5em;
}
#textbox::-webkit-input-placeholder{
color:transparent;
}
#textbox::-webkit-input-placeholder::before {
color:#666;
content:"program?*";
}
h2 {
font-weight: bold;
font-size: 1em;
font-family: 'Open Sans', sans-serif;
}
ul.inline {
list-style-type: none;
columns: 2;
-webkit-columns: 2;
-moz-columns: 2;
list-style-position: inside;
padding: 0px;
margin: 0px;
}
ul.inline li {
padding: 5px;
background-image: url(check.png);
background-repeat: no-repeat;
background-size: 25px;
background-position: 0px center;
padding-left: 25px;
}
#fun {
float: left;
padding-bottom: 50px;
}
#creativity {
padding-bottom: 80px;
}
#community {
float: left;
margin-left: 75px;
}
#innovation {
float: left;
margin: 30px;
}
#challenge {
float: left;
margin-left: 100px;
margin-top: -25px;
margin-bottom: 5em;
height: 220px;
}
#csanad {
height: 130px;
float: left;
margin-left: 5%;
margin-top: 4%;
padding-bottom: 80px;
}
#adam {
height: 130px;
float: left;
margin-left: 0%;
margin-top: 70px;
}
#adamtxt {
font-size: 0.9em;
width: 61%;
float:left;
margin-top: 72px;
margin-left: 25px;
}
#rapper {
width:400px;
float: left;
}
#csanadtxt {
font-size: 0.9em;
width: 32%;
float:left;
margin-top: 4%;
margin-left: 25px;
}
#noura {
height: 130px;
float: left;
margin-left: 15px;
margin-top: 75px;
}
#nouratxt {
font-size: 0.9em;
width: 23%;
float:left;
margin-top: 80px;
margin-left: 25px;
}
#container {
}
div#logo img {
position: absolute;
height: 25px;
}
#menu{
position: relative;
padding: 0px;
float: right;
}
ul#menu li {
list-style: none;
display: inline-block;
font-size: 0.95em;
height: 1vw;
}
ul#menu li a {
padding: 5px;
padding-left: 0.45vw;
padding-right: 0.45vw;
color: #ff4412;
font-family: 'Open Sans', sans-serif;
outline: none;
text-transform: uppercase;
border-radius: 5px;
}
div#container div#header div#header-inner ul#menu li a:focus {
text-decoration: none;
}
div#container div#header div#header-inner ul#menu li a:hover {
background: #ff4412;
color: white;
text-decoration: none;
}
div#container div#header div#header-inner ul#menu li.highlight a {
color: white;
border-radius: 5px;
background: #ff4412;
}
div#container div#header div#header-inner ul#menu li.highlight:hover {
opacity: 0.9;
}
Explanation
How the browser see your CSS without !important:
for screen 200px < x < 800px do this {
bla bla bla
}
but... wait a second.. forget about it, do this for all screens {
bla bla bla
}
When you add !important the browser will take it like this:
for screen 200px < x < 800px do this {
bla bla bla
!do not listen to me if I will ever give you any other instructions
}
but... hey dude, want any instructions? Can you do this for all screens? {
bla bla bla
}
If you place #media block in the end of your file and remove all the !importants it will look like this:
for all screens do this {
bla bla bla
}
but for screens 200px < x < 800px do this {
bla bla bla
}
Demo
Open this snippet in full page mode and try to change browser's window size
#media (max-width: 800px) {
.bad {
background-color: green;
}
}
.bad, .good {
width: 100px;
height: 100px;
background-color: firebrick;
}
#media (max-width: 800px) {
.good {
background-color: green;
}
}
<div class="good"></div>
<div class="bad"></div>
Flip the order to place the media query later. It doesn't seem to add any selector weight, so the later one takes priority.
So you would have (snipped):
html body {
position: absolute;
height: 100%;
width: 100% !important;
margin: 0 auto;
text-align:center;
}
#media all and (min-width: 200px) and (max-width: 850px) {
html body {
position: absolute;
height: 100%;
width: 100% !important;
margin: 0 auto;
text-align:center;
}
}
See, for example, CSS specificity on MDN, which does not list #media-queries as increasing weight.
In my case, my media queries were being added after the initial SCSS and they were still being overridden.
I found out it was because the nesting did not match between the initial styles and the media queries!
I had:
.icon-tray {
// stuff
.icon-tray-icon {
// stuff
div {
// stuff
}
}
}
Then, my media queries had:
// Medium devices (tablets, 768px and up)
#media (min-width: 768px) {
.icon-tray {
// stuff
}
.icon-tray-icon {
// stuff
div {
// stuff
}
}
}
So I changed it to this, and it worked:
#media (min-width: 768px) {
.icon-tray {
// stuff
.icon-tray-icon {
// stuff
div {
// stuff
}
}
}
}
Hope it's clear and helps someone!
css style priority sequence
"!important"
Priority goes to most explicitly define rule.
ex:
1)
.class1 {
.class2 {
.class3 { color: green }
}
}
2)
.class1 {
.class3 { color: red }
}
Priority goes by order (bottom are prior to top)
You must check <head> tag. First, include the main style css file and then include the responsive css file.
something like this :
<link rel="stylesheet" type="text/css" href="mainstyle.css">
<link rel="stylesheet" type="text/css" href="reponsive.css">
Put your responsive css after style css if there is matched issue. Problem will solved.
I had the same issue. I resolved it by placing the media query styles at the end of other styles.

Wrapper not to go from top to bottom

Ok, I give up - I can't work it out; the wrapper seems to go from the top to the bottom while I want it to leave a gap at the top and bottom so the background appears through. I can't seem to work it out. I am very novice to this. Any help & ideas very welcome.
Code
body {
background: #ffffff url(bgfin.jpg) repeat;
font-family: Tahoma,arial, sans-serif;
font-size:12px;
color:#666666;
height: 100%;
margin:0;
padding:0;
}
#wrapper {
background: url(body-line.png) center repeat-y;
padding-top: 65px;
padding-bottom: 65px;
}
#wrappertop{
background: url(header.png) top center no-repeat;
}
#wrappertbtm{
background: url(footer-new.png) bottom center no-repeat;
padding-bottom: 65px;
}
#container{
width: 959px;
margin: 0 auto;
}
.title{
width: 959px;
height: 56px;
padding: 15px 0px 10px 0px;
font-size: 30px;
color: #bd7821;
}
#navigation{
position: relative;
width: 959px;
height: 40px;
z-index: 2;
}
#navigation li{
float: left;
z-index: 2;
padding: 0px 34px 0px 0px;
}
#navigation li a{
display: inline-block;
position: relative;
outline: none;
height: 28px;
color: #e3e3e3;
z-index: 2;
font-size: 12px;
padding: 15px 0px 0px 0px;
text-decoration: none;
}
#navigation li a:hover, #navigation li#active a{
color: #bd7821;
text-decoration: none;
}
#header{
position: relative;
width: 959px;
height: 196px;
z-index: 1;
margin: 20px 0px 0px 0px;
}
Try:
body { padding:20px 0; }
Or:
#wrapper { margin:20px 0; }
That is shorthand for:
#wrapper {
margin-top:20px;
margin-right:0;
margin-bottom:20px;
margin-left:0;
}
Remember:
Padding is rendered inside of the element
Margin is on the outside
This might help as a reminder:
How to remember in CSS that margin is outside the border, and padding inside

IE hates my CSS file so much I get no content!

My web site seems to be working fine with every other broser but IE8, IE9 and compatibility mode!!
As soon as I disable my CSS, I see content, but when its switched back on I get nothing!
This is giving my hell.
This is my CSS here:
body {
background: center top url(./images/background.jpg) no-repeat;
background-color: #FFF;
margin: 0px;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
color: #8e8f91;
}
h1 {
font-size: 12px;
color: #FFFFFF;
text-transform: uppercase;
line-height: normal;
margin: 0;
padding: 0;
letter-spacing: 1px;
}
#Table_01 {
top:0px;
width:1200px;
margin: 0 auto;
}
.backing {
background: repeat transparent url(./images/backing.png);
padding: 4px;
margin-left: 4px;
margin-top: 443px;
width: 130px;
text-transform: uppercase;
color: #FFF;
font-size: 11px;
letter-spacing: 1px;
}
.backing a, a:active {
text-decoration: none;
color: #FFFFFF;
}
.backing a:hover {
text-decoration: underline;
color: #FFFFFF;
}
.snipet {
background: repeat transparent url(./images/backing.png);
padding: 4px;
margin: 4px;
width: 100px;
text-transform: uppercase;
color: #FFF;
font-size: 11px;
letter-spacing: 1px;
}
.snipet_text {
font-size: 12px;
font-style: italic;
font-weight: normal;
letter-spacing: 0px;
line-height: 18px;
}
.snipet_container {
margin: 10px;
}
a, a:active {
text-decoration: underline;
color: #8e8f91;
}
a:hover {
text-decoration: none;
}
a img {
border:none;
}
.clear {
clear:both;
}
ul.menu {
list-style:none;
margin: 0;
padding: 0;
}
ul.menu li {
width:auto;
height:29px;
margin-left: 1px;
}
ul.menu li a {
display:block;
position:relative;
}
ul.menu li a img {
position:absolute;
z-index:1;
}
ul.menu li span {
display:block;
height: 29px;
width: auto;
position:absolute;
z-index:2;
}
/* TABLES */
div.index-1_ {
position:absolute;
left:0px;
top:0px;
width:1200px;
height:17px;
}
div.index-2_ {
position:absolute;
left:0px;
top:22px;
width:33px;
height:675px;
}
div.index-3_ {
position:absolute;
left:33px;
top:22px;
width:208px;
height:221px;
}
div.index-4_ {
position:absolute;
left:241px;
top:22px;
width:12px;
height:675px;
}
div.index-5_ {
position:absolute;
left:254px;
top:22px;
width:82px;
height:29px;
}
div.index-6_ {
position:absolute;
left:335px;
top:22px;
width:10px;
height:43px;
}
div.index-7_ {
position:absolute;
left:346px;
top:22px;
width:102px;
height:29px;
}
div.index-8_ {
position:absolute;
left:447px;
top:22px;
width:11px;
height:43px;
}
div.index-9_ {
position:absolute;
left:459px;
top:22px;
width:77px;
height:29px;
}
div.index-10_ {
position:absolute;
left:535px;
top:22px;
width:10px;
height:43px;
}
div.index-11_ {
position:absolute;
left:546px;
top:22px;
width:87px;
height:29px;
}
div.index-12_ {
position:absolute;
left:632px;
top:22px;
width:10px;
height:43px;
}
div.index-13_ {
position:absolute;
left:643px;
top:22px;
width:73px;
height:29px;
}
div.index-14_ {
position:absolute;
left:715px;
top:22px;
width:485px;
height:43px;
}
div.index-15_ {
position:absolute;
left:253px;
top:46px;
width:82px;
height:14px;
}
div.index-16_ {
position:absolute;
left:345px;
top:46px;
width:102px;
height:14px;
}
div.index-17_ {
position:absolute;
left:458px;
top:46px;
width:77px;
height:14px;
}
div.index-18_ {
position:absolute;
left:545px;
top:46px;
width:87px;
height:14px;
}
div.index-19_ {
position:absolute;
left:642px;
top:46px;
width:73px;
height:14px;
}
div.index-20_ {
position:absolute;
left:253px;
top:60px;
width:1px;
height:481px;
}
div.index-21_ {
position:absolute;
left:254px;
top:60px;
width:249px;
height:470px;
background-image: url(./images/projects/HomeProject001.jpg);
}
div.index-22_ {
position:absolute;
left:503px;
top:60px;
width:618px;
height:442px;
background-color: #CBCBCB;
}
div.index-23_ {
position:absolute;
left:1121px;
top:60px;
width:79px;
height:632px;
}
div.index-24_ {
position:absolute;
left:33px;
top:238px;
width:208px;
height:67px;
}
div.index-25_ {
position:absolute;
left:503px;
top:502px;
width:606px;
height:16px;
background-image: url(./images/index-25.png);
padding:6px;
}
div.index-26_ {
position:absolute;
left:254px;
top:530px;
width:867px;
height:11px;
}
div.index-27_ {
position:absolute;
left:253px;
top:541px;
width:619px;
height:151px;
background-color: #FFF;
}
div.index-28_ {
position:absolute;
left:872px;
top:541px;
width:249px;
height:151px;
background-image: url(./images/index-28.png);
}
/* sliding panel */
/***** clearfix *****/
.clear {clear: both;height: 0;line-height: 0;}
.clearfix:after {content: ".";display: block;height: 0;clear: both;visibility: hidden;}
.clearfix {display: inline-block;}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
.clearfix {height: 1%;}
.clearfix {display: block;}
#toppanel {
position: absolute; /*Panel will overlap content */
/*position: relative;*/ /*Panel will "push" the content down */
top: 0;
left: 0;
width: 100%;
z-index: 999;
text-align: center;
margin-left: auto;
margin-right: auto;
font-size: 130%; /* font-size set to 130% for the default Kubrick Wordpress theme */
}
#panel {
width: 100%;
height: 280px;
color: #333;
background: transparent url(images/tab_bk.png) repeat;
overflow: hidden;
position: relative;
z-index: 3;
display: none;
}
#panel h1 {
font-size: 1.6em;
padding: 5px 0 10px;
margin: 0;
color: #15ADFF;
text-align: left;
}
#panel h2{
font-size: 1.2em;
padding: 10px 0 5px;
margin: 0;
color: #e01000;
text-align: left;
}
#panel p {
margin: 5px 0;
padding: 0;
}
#panel a {
text-decoration: underline;
color: #333;
}
#panel a:hover {
color: #666;
}
#panel a-lost-pwd {
display: block;
float: left;
}
#panel ul {
margin: 0 0 5px 0;
padding: 0;
line-height: 1.6em;
list-style: none;
}
#panel .content {
width: 960px;
margin: 0 auto;
padding-top: 15px;
text-align: left;
font-size: 0.85em;
}
#panel .content .left {
width: 280px;
float: left;
margin-bottom: 25px;
padding: 0 15px;
min-height: 220px;
}
#panel .content .border {
border-left: 1px solid #333;
}
#panel .content .narrow {
width:1000px !important;
}
#panel .content form {
margin: 0 0 10px 0;
}
#panel .content label {
padding-top: 8px;
clear: both;
width: 280px;
display: block;
}
#panel .content input.field {
border: 1px #1A1A1A solid;
background-color: #efefef;
margin-right: 5px;
margin-top: 4px;
width: 300px;
color: white;
height: 16px;
}
#panel .content input:focus.field {
background: #ccc;
}
#panel .content .ui-state-highlight .ui-icon {background-image: url(./images/icon_sprite.png); width: 16px; height: 16px; margin-top: -2px;}
#panel .content .ui-state-error .ui-icon, #panel .content .ui-state-error-text .ui-icon { background: url(./images/icon_sprite.png) -16px 0 no-repeat !important; width: 16px; height: 16px; margin-top: -2px;}
#panel .content .ui-state-highlight { border: 1px solid #d2dbf4; background: #f4f8fd; color: #0d2054; }
#panel .content .ui-state-error { border: 1px solid #e2d0d0; background: #fcf0f0; color: #280b0b;}
/* BUTTONS */
#panel .content .ui-button {
outline: none;
color: #1c4257;
border-color: #7096ab;
display: block;
font-size: 14px;
font-weight: bold;
border: thin solid;
margin-top: 20px;
padding: 4px 20px 4px 20px;
}
#panel .content .ui-button:hover {
background: #fbc900;
}
/* Panel Tab/button */
.tab {
height: 25px;
position: relative;
top: 0;
z-index: 999;
}
.tab ul.login {
display: block;
position: relative;
float: right;
clear: right;
width: auto;
font-weight: bold;
line-height: 25px;
margin: 0;
right: 150px;
color: white;
font-size: 80%;
text-align: center;
}
.tab ul.login li.left {
background: url(images/tab_l.png) no-repeat left 0;
height: 25px;
width: 30px;
padding: 0;
margin: 0;
display: block;
float: left;
}
.tab ul.login li.right {
background: url(images/tab_r.png) no-repeat left 0;
height: 25px;
width: 30px;
padding: 0;
margin: 0;
display: block;
float: left;
}
.tab ul.login li {
text-align: left;
padding: 0 6px;
display: block;
float: left;
height: 25px;
background: url(images/tab_m.png) repeat-x 0 0;
}
.tab ul.login li a {
color: #15ADFF;
}
.tab ul.login li a:hover {
color: #333;
}
.tab .sep {color:#666}
.tab a.open, .tab a.close {
height: 20px;
line-height: 20px !important;
padding-left: 30px !important;
cursor: pointer;
display: block;
width: 100px;
position: relative;
top: 2px;
}
.tab a.open {background: url(images/bt_open.png) no-repeat left 0;}
.tab a.close {background: url(images/bt_close.png) no-repeat left 0;}
.tab a:hover.open {background: url(images/bt_open.png) no-repeat left -19px;}
.tab a:hover.close {background: url(images/bt_close.png) no-repeat left -19px;}
I know it's a little messy... Sorry :(
how to determine the error:
remove all classes from the stylesheet.
add the classes one by one.
see when/where it fails
fix/solve bug
if not at the end proceed to step 2
#panel {
width: 100%;
height: 280px;
color: #333;
background: transparent url(images/tab_bk.png) repeat;
overflow: hidden;
position: relative;
z-index: 3;
display: none;
}
Though the DIV was actually closed off, for some reason IE completely ignored it!
This was the problem:
display: none;
So all I did was place the DIV in the footer at it all worked. It still puzzled me why it was only doing it in IE!!

HTML/CSS Element lose its position in other computers but not in mine

I'm not sure if the resolution of the screen can affect the CSS. My screen resolution is 1280 x 1024.
Last time, I tried my website: http://alexchen.co.nr/ in a friends's laptop and my webpage and an element (I think is #lang) moved out of place (i think it only happened in Chrome).
In my computer everything is fine (Firefox, Chrome, IE6, 7 , 8, etc.)
CSS (I'm also using Eric Meyer's CSS reset):
/* tags */
body {
background: #FFF;
color: #666;
font-family: Arial, "MS Trebuchet", sans-serif;
font-size: 75%;
}
h1 {
font-size: 28px;
}
h2 {
color: #DDD;
font-size: 18px;
padding: 0 0 10px 0;
}
h3 {
color: #666;
font-size: 10px;
font-weight: 700;
padding: 0 0 10px 0;
text-transform: uppercase;
}
p {
line-height: 160%;
}
a {
/*color: #0AE;*/
color: #08B;
list-style: none;
text-decoration: none;
}
a:hover {
color: #044;
}
/* structure */
.container {
overflow: hidden;
width: 960px;
}
/* header */
#header {
}
#header h1 {
padding: 190px 20px 5px;
overflow: hidden;
}
#header h1 a {
background: url(../images/logo.png) no-repeat scroll 0 0;
float: left;
text-indent: -9999px;
width: 216px;
height: 28px;
}
/* banner */
#lang {
float: right;
padding: 202px 0 0 0;
}
#lang li {
float: left;
}
#lang li a {
float: left;
font-size: 8px;
padding: 0 5px;
text-transform: uppercase;
}
#lang li.current a {
color: #666;
cursor: default;
border-bottom: 0px;
}
/* intro */
#banner {
overflow: hidden;
width: 960px;
}
#banner h3 a {
font-size: 28px;
}
#logo {
background-color: #222;
float: left;
overflow: hidden;
height: 169px;
width: 240px; /* ie6 hack */
height: 240px; /* ie6 hack */
}
#logo2 {
background: -moz-linear-gradient(top, #FFF, #DDD);
background: -webkit-gradient(linear, left top, left bottom, from(#FFF), to(#DDD));
filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#FFFFFF', EndColorStr='#DDDDDD');
background-color: #DDD;
float: left;
overflow: hidden;
height: 169px;
width: 240px; /* ie6 hack */
height: 240px; /* ie6 hack */
}
#logo3 {
background: -moz-linear-gradient(top, #FFF, #DDD);
background: -webkit-gradient(linear, left top, left bottom, from(#FFF), to(#DDD));
filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#FFFFFF', EndColorStr='#DDDDDD');
background-color: #DDD;
float: left;
overflow: hidden;
height: 169px;
width: 240px; /* ie6 hack */
height: 240px; /* ie6 hack */
}
#nav {
float: left;
padding: 200px 0 0 40px;
}
#nav li {
float: left;
}
#nav li a {
float: left;
border-left: 1px solid #08B;
font-size: 10px;
padding: 0 10px;
text-transform: uppercase;
}
#nav li.current a {
color: #888;
cursor: default;
border-bottom: 0px;
}
#tagline {
float: left;
margin: 0 40px 0 0;
width: 540px; /* 560 */
}
#tagline h3 {
font-size: 24px;
}
/* work */
#content {
color: #888;
}
.showcase {
overflow: hidden;
width: 960px; /* ie hack */
}
.first {
background: #222;
display: inline; /* ie6 hack */
float: left;
overflow: hidden;
position: relative;
width: 240px;
height: 240px;
}
.first h3, .first p {
color: #DDD;
padding: 20px;
}
.pusher {
background: #333;
display: inline; /* ie6 hack */
float: left;
overflow: hidden;
position: relative;
width: 240px;
height: 240px;
}
.blank-pusher {
background: #DDD;
display: inline; /* ie6 hack */
float: left;
overflow: hidden;
position: relative;
width: 240px;
height: 240px;
}
.pusher h3 {
color: #DDD;
padding: 120px 20px 10px;
}
.pusher p {
color: #DDD;
padding: 0 20px;
}
.nopic {
display: block;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
}
.pic {
display: block;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
opacity: 1;
}
.pic:hover {
opacity: 0.1;
filter: alpha(opacity = 10);
}
#fancybox-outer {
height: 100% !important;
}
#fancybox-inner {
height: 100% !important;
}
#inline1, #inline2, #inline3, #inline4, #inline5, #inline6, #inline7, #inline8 {
width: 680px;
}
#inline1 img, #inline2 img, #inline3 img, #inline4 img, #inline5 img, #inline6 img, #inline7 img, #inline8 img {
margin: 0 0 10px 0;
}
(continues...)
Normal display:
alt text http://img202.imageshack.us/img202/9638/normale.png
Abnormal display:
alt text http://img199.imageshack.us/img199/2846/notnormal.png
I think I in my friend's laptop the horizontal width, padding or margin of some elements was duplicated or something.
I made the text inside #lang a bit smaller, but not sure if the problem still there.
Is my webpage: http://alexchen.co.nr/ displaying correctly in your current screen resolution (IE, Firefox and Chrome)?
If not how do I fix it? what's causing the problem?
Too see what your site looks like for different machines, OSs, and browsers, check out http://browsershots.org/.
I just submitted a job here. Your site loads very slowly (try YSlow or Page Speed to see how you can speed it up) so some browsers will time out before it finishes and you'll see a blank screen.
Try to find out your friend's precise OS, browser type, and browser version. If he's on Chrome 4 and you're on Chrome 5, for instance, results can be different.

Need to make div and css based pages work in IE 7

I am working on a project where I need to build the pages using div tags and css. The pages look fine in Firefox, Opera, Safari and IE 8, but my client who is using IE7 is complaining of layout problems in IE 7. Can someone take a look and tell me how to fix the code so it will work in all the browsers, especially IE 7? Links and css code is below. Thanks.
Home Page is here: (Code is below)
http://www.danieldicenso.20m.com/citybeams/
/* HOME PAGE CSS CODE */
body {font-size:12px; font-family:"trebuchet MS", verdana, arial, sans-serif; background: #CCCCCC; word-wrap:break-word;}
#wrapper {
text-align: left;
margin: 0px auto;
padding: 0px;
border:0;
width: 1000px;
background: #FFFFFF;
}
#header {
margin: 0 0 15px 0;
background: #ffffff;
}
#side-a {
float: left;
width: 300px;
}
#side-b {
float: right;
width: 300px;
}
#content {
float: left;
width: 400px;
}
#footer {
clear: both;
background: #ffffff;
}
.curvy2 {
position:relative;
width:250px;
color:#000;
margin-top: 1em;
margin-right: auto;
margin-bottom: 1em;
margin-left: auto;
background-color: #99FF99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: left bottom;
}
#ctl, #cbl, #ctr, #cbr {position:absolute; width:20px; height:20px; color:#327734; background:#fff; background-image:url(metalgreen2.jpg); overflow:hidden; font-style:normal; z-index:1;}
#ctl {top:0; left:0;}
#cbl {bottom:0; left:0;}
#ctr {top:0; right:0;}
#cbr {bottom:0; right:0;}
.curvy em b {position:absolute; font-size:150px; font-family:arial; color:#327834; line-height:40px; font-weight:normal;}
#ctl b {left:-8px;}
#ctr b {left:-25px;}
#cbl b {left:-8px; top:-17px;}
#cbr b {left:-25px; top:-17px;}
.curvy p {position:relative; z-index:100; padding:5px 10px;}
.bl {
width: 330px;
background-color: #99ff99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: 0 100%;
}
.br {background: url(br.gif) 100% 100% no-repeat}
.tl {background: url(tl.gif) 0 0 no-repeat}
.tr {background: url(tr.gif) 100% 0 no-repeat; padding:10px}
.clear {font-size: 1px; height: 1px}
.bl2 {
width: 330px;
background-color: #ffffff;
background-image: url;
background-repeat: no-repeat;
background-position: 0 100%;
}
.br2 {background: url100% 100% no-repeat}
.tl2 {background: url 0 0 no-repeat}
.tr2 {background: url 100% 0 no-repeat; padding:10px}
.clear2 {font-size: 1px; height: 1px
}
#navmenu {
position: relative;
left: 16px;
top: 0px;
width: 712px;
height: 22px;
z-index: 2;
background: #99FF99;
text-align: center;
padding: 0px;
}
body,td,th {
color: #000000;
}
a:link {
color: #003333;
}
a:visited {
color: #000066;
}
a:active {
color: #FF0000;
}
--------------------
Sign-up page is here: (CSS Code below)
http://www.danieldicenso.20m.com/citybeams/signuppage.html
/* SIGNUP PAGE CSS CODE */
body {font-size:12px; font-family:"trebuchet MS", verdana, arial, sans-serif; background: #CCCCCC; word-wrap:break-word;}
#wrapper {
text-align: left;
margin: 0px auto;
padding: 0px;
border:0;
width: 1000px;
background: #FFFFFF;
}
#header {
margin: 0 0 15px 0;
background: #ffffff;
}
#side-a {
float: left;
width: 100px;
}
#side-b {
float: right;
width:100px;
}
#content {
float: left;
width: 800px;
}
#footer {
clear: both;
background: #ffffff;
}
.curvy2 {
position:relative;
width:250px;
color:#000;
margin-top: 1em;
margin-right: auto;
margin-bottom: 1em;
margin-left: auto;
background-color: #99FF99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: left bottom;
}
#ctl, #cbl, #ctr, #cbr {position:absolute; width:20px; height:20px; color:#327734; background:#fff; background-image:url(metalgreen2.jpg); overflow:hidden; font-style:normal; z-index:1;}
#ctl {top:0; left:0;}
#cbl {bottom:0; left:0;}
#ctr {top:0; right:0;}
#cbr {bottom:0; right:0;}
.curvy em b {position:absolute; font-size:150px; font-family:arial; color:#327834; line-height:40px; font-weight:normal;}
#ctl b {left:-8px;}
#ctr b {left:-25px;}
#cbl b {left:-8px; top:-17px;}
#cbr b {left:-25px; top:-17px;}
.curvy p {position:relative; z-index:100; padding:5px 10px;}
.bl {
width: 330px;
background-color: #99ff99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: 0 100%;
}
.br {background: url(br.gif) 100% 100% no-repeat}
.tl {background: url(tl.gif) 0 0 no-repeat}
.tr {background: url(tr.gif) 100% 0 no-repeat; padding:10px}
.clear {font-size: 1px; height: 1px}
.bl2 {
width: 330px;
background-color: #ffffff;
background-image: url;
background-repeat: no-repeat;
background-position: 0 100%;
}
.br2 {background: url100% 100% no-repeat}
.tl2 {background: url 0 0 no-repeat}
.tr2 {background: url 100% 0 no-repeat; padding:10px}
.clear2 {font-size: 1px; height: 1px}
#navmenu {
position: relative;
left: 16px;
top: 0px;
width: 712px;
height: 22px;
z-index: 2;
background: #99FF99;
text-align: center;
padding: 0px;
}
.signupfield {
float: none;
width:480px;
color:#000;
margin-top: 1em;
margin-right:1 em;
margin-bottom: 1em;
position: relative;
left: 75px;
background-color: #99FF99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: left bottom;
}
----------------------------------
Reviews page example is here: (CSS code below)
http://www.danieldicenso.20m.com/citybeams/reviewers.html
/* REVIEW PAGE CSS CODE */
body {font-size:12px; font-family:"trebuchet MS", verdana, arial, sans-serif; background: #CCCCCC; word-wrap:break-word;}
#wrapper {
text-align: left;
margin: 0px auto;
padding: 0px;
border:0;
width: 1000px;
background: #FFFFFF;
}
#header {
margin: 0 0 15px 0;
background: #ffffff;
}
#side-a {
float: left;
width: 50px;
}
#side-b {
float: right;
width: 200px;
}
#content {
float: left;
width: 750px;
}
#footer {
clear: both;
background: #ffffff;
}
.curvy2 {
position:relative;
width:250px;
color:#000;
margin-top: 1em;
margin-right: auto;
margin-bottom: 1em;
margin-left: auto;
background-color: #99FF99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: left bottom;
}
#ctl, #cbl, #ctr, #cbr {position:absolute; width:20px; height:20px; color:#327734; background:#fff; background-image:url(metalgreen2.jpg); overflow:hidden; font-style:normal; z-index:1;}
#ctl {top:0; left:0;}
#cbl {bottom:0; left:0;}
#ctr {top:0; right:0;}
#cbr {bottom:0; right:0;}
.curvy em b {position:absolute; font-size:150px; font-family:arial; color:#327834; line-height:40px; font-weight:normal;}
#ctl b {left:-8px;}
#ctr b {left:-25px;}
#cbl b {left:-8px; top:-17px;}
#cbr b {left:-25px; top:-17px;}
.curvy p {position:relative; z-index:100; padding:5px 10px;}
.bl {
width: 330px;
background-color: #99ff99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: 0 100%;
}
.br {background: url(br.gif) 100% 100% no-repeat}
.tl {background: url(tl.gif) 0 0 no-repeat}
.tr {background: url(tr.gif) 100% 0 no-repeat; padding:10px}
.clear {font-size: 1px; height: 1px}
.bl2 {
width: 330px;
background-color: #ffffff;
background-image: url;
background-repeat: no-repeat;
background-position: 0 100%;
}
.br2 {background: url100% 100% no-repeat}
.tl2 {background: url 0 0 no-repeat}
.tr2 {background: url 100% 0 no-repeat; padding:10px}
.clear2 {font-size: 1px; height: 1px}
#navmenu {
position: relative;
left: 16px;
top: 0px;
width: 712px;
height: 22px;
z-index: 2;
background: #99FF99;
text-align: center;
padding: 0px;
}
.signupfield {
position:relative;
width:480px;
color:#000;
margin-top: 1em;
margin-right: auto;
margin-bottom: 1em;
margin-left: -120px;
background-color: #99FF99;
background-image: url(bl.gif);
background-repeat: no-repeat;
background-position: left bottom;
}
body,td,th {
color: #000000;
}
a:link {
color: #003333;
}
a:visited {
color: #000066;
}
a:active {
color: #FF0000;
}
#selectionbar {
position: relative;
left: 0px;
top: 0px;
width: 750px;
height: 22px;
z-index: 2;
background: #ffffff;
padding: 0px;
}
#selectionbartwo {
position: relative;
left: 0px;
top: -10px;
width: 750px;
height: 22px;
z-index: 2;
background: #ffffff;
padding: 0px;
}
#selectionbarthree {
position: relative;
left: 0px;
top: -10px;
width: 750px;
height: 22px;
z-index: 2;
background: #ffffff;
padding: 0px;
}
#dividerline {
position: relative;
left: 0px;
top: -4px;
width: 750px;
height: 1px;
z-index: 2;
background: #ffffff;
padding: 0px;
}
#results {
position: relative;
left: 55px;
top: -14px;
width: 600px;
height: 1px;
z-index: 2;
background: #ffffff;
padding: 0px;
}
If default margins and padding are indeed your problem as Ryan so helpfully suggested, you can force every element to have the same base margin and padding with the following statement:
* {
margin: 0px;
padding: 0px;
}
Note that this will probably break your layout in the other browsers too, but at least they'll all be broken the exact same way.
IE7 has different defaults and behaviour for margin and padding than the other browsers. A quick viewing of the page in IE7 suggests that is likely where the majority of your problems are.
You might try using padding to offset navmenu instead of using position:relative and left.
Don't use
*{margin: 0px;padding: 0px;}
U dont want to rewrite your whole site for html elements who actually need the default value.
use css reset
Use xhtml and css valid code
And fix common bugs
You can force your IE8 to render pages like IE7 and check the layout yourself.
Read that: http://blogs.msdn.com/ie/archive/2008/08/27/introducing-compatibility-view.aspx
Use:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
but only for debug
To test how your page looks in IE7 without meta-tag tricks or similar, you can download a virtual sandboxed browser from here: http://www.xenocode.com/browsers/ Great for testing web applications.

Resources