Zoom in/out how do I keep the aspect ratio? - html

Working Example: http://jsfiddle.net/4jmY2/4/
If you Zoom in/out (ctrl +/-) you will see the elements move around, how can I keep the aspect ratio so the content will remain the same no matter what size?
HTML
<div class="check_box">
<div class="check">
<div class="your_name">Your Name</div>
<div class="bank_name">Your Bank Name</div>
<div class="check_number_top">1001</div>
<div class="your_address">Your Address</div>
<div class="bank_address">Bank Address</div>
<br />
<div class="date">Date ________</div>
<br />
<div class="pay">Pay to the<br />Order of _______________________________ $________</div>
<br />
<div class="pay_line">_________________________________________ Dollars</div>
<br />
<div class="sign">_____________________</div>
<br />
<div class="check_number_bottom">⑈<strong>1001</strong>⑈</div>
<div class="routing_number">⑆<strong>123456789</strong>⑆</div>
<div class="account_number"><strong>987 6543210</strong> ⑈</div>
</div>
</div>
CSS
.check_box {
width: 300px;
}
.check {
border: 2px solid #1A1B1B;
background-color: #DFE5E5;
height: 110px;
font-size:80%;
font-family: Georgia;
padding:0px;
margin: 0px;
}
.your_name {
float:left;
padding:0px 30px 0px 5px;
font-size:105%;
}
.your_address {
float:left;
padding:0px 40px 0px 5px;
font-size:85%;
}
.bank_name {
float:left;
padding:0px 30px 0px 5px;
font-size:105%;
}
.bank_address {
float:left;
padding:0px 30px 0px 5px;
font-size:85%;
}
.check_number_top {
float:left;
padding:0px 0px 0px 40px;
font-size:105%;
}
.date {
float:left;
padding:0px 0px 0px 220px;
font-size:85%;
}
.pay {
float:left;
padding:0px 0px 0px 5px;
font-size:85%;
}
.pay_line {
float:left;
padding:0px 0px 0px 5px;
font-size:85%;
}
.sign {
float:left;
padding:0px 0px 0px 165px;
font-size:85%;
}
.check_number_bottom {
float:left;
padding:0px 0px 0px 5px;
font-size:85%;
font-family:"Arial Narrow"; /* need to change the font's of the numbers */
}
.routing_number {
float:left;
padding:0px 0px 0px 5px;
font-size:85%;
font-family:"Arial Narrow"; /* need to change the font's of the numbers */
}
.account_number {
float:left;
padding:0px 0px 0px 10px;
font-size:85%;
font-family:"Arial Narrow"; /* need to change the font's of the numbers */
}
.routing_number_tip {
float:left;
padding:0px 0px 0px 10px;
font-size:85%;
color:#1F4CA5;
}
.account_number_tip {
float:left;
padding:0px 0px 0px 10px;
font-size:85%;
color:#1F4CA5;
}

Well, I finally had a go at doing this. I had to do it from scratch, and it took a while.
Live Demo
It looks like this for me:
Tested in IE7/8 plus recent versions of Firefox, Chrome, Safari, Opera.
You can zoom in!
If there's anything wrong or you have any questions, let me know.
HTML:
<div class="check_box">
<div class="check">
<span class="your_left"><em>Your Name</em><br />Your Address</span>
<span class="your_mid"><em>Your Bank Name</em><br />Bank Address</span>
<span class="your_right"><em>1001</em></span>
<span class="date">Date<span></span></span>
<span class="pay_to">Pay to the<br />Order of<span></span></span>
<span class="dollar"><br />$<span></span></span>
<span class="dollars"><span></span>Dollars</span>
<span class="extraline"><span></span></span>
<span class="numbers">
<span>⑈<b>1001</b>⑈</span>
<span>⑆<b>123456789</b>⑆</span>
<span><b>987 6543210</b> ⑈</span>
</span>
</div>
</div>
CSS:
.check_box {
font: 10px/1.3 Georgia, serif;
border: 2px solid #1a1b1b;
background-color: #dfe5e5;
width: 292px;
padding: 4px;
margin: 0
}
.check {
position: relative;
height: 102px
}
.check > span {
position: absolute
}
.check em {
font-size: 12px;
font-style: normal
}
.date span, .pay_to span, .dollar span, .dollars span, .extraline span {
border-bottom: 1px solid #000;
zoom: 1 /* fix ie7 */
}
.your_left {
top: 0; left: 0
}
.your_mid {
top: 0; left: 95px; text-align: center
}
.your_right {
top: 0; right: 0
}
.date {
top: 28px; right: 0
}
.date span {
padding-left: 50px;
margin: 2px 0 0 3px
}
.pay_to {
top: 35px; left: 0
}
.pay_to span {
padding-left: 180px;
margin-left: 3px
}
.dollar {
top: 35px; right: 0; text-align: right
}
.dollar span {
padding-left: 50px;
margin-left: 3px
}
.dollars {
top: 62px; left: 0
}
.dollars span {
padding-left: 250px;
margin-right: 3px
}
.extraline {
top: 76px; right: 0
}
.extraline span {
padding-left: 120px
}
.numbers {
bottom: 0; left: 0
}
.numbers span {
margin: 0 10px 0 0
}

Not sure that I understand your question. But when I zoom in, the text components scale up while the background "check" style does not.
It sounds like you want the check to scale up as well. If so, you might need to create em-driven div styles, which will scale with the browsers font selection.
Here's a good article with several examples.

Related

HTML Button Tag misaligned

('Boy... I saw on search that misalign topic about the <input> wrapped on an <a> tag... LOL)
Anyway...
I'm in a bit of a pickle here... I have a bunch of divs as an inline block lead by a lone <button>, and this lone button --- no matter how much design genius I summon from myself, I can't get to align properly.
Just look at the code at the end of the post.
Notes:
The button-holder class didn't used to exist; it was just the <button><span> combo. I added it thinking I can fix it by doing negative values on the margin (to no avail).
Can anyone advise?
FULL code:
<style type="text/css">
body { margin:0; padding:0;font-size: 9pt; }
#main { margin: 0; padding: 0; width:100%; text-align:center; }
#bar {display: table; margin: 0; padding: 0; width:100%; height:45px }
[class~=banner] { font-size: 14pt;
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
display: table-cell;
height: 45px;
vertical-align: middle;}
.cellOne { background-color:#FFC316;
color: #35549A;
width: 8%;
text-align:center;}
.cellTwo { background-color: #35549A;
color: #FFF;
padding: 0px 0px 0px 2%;
width: 68%;
text-align: left;}
.cellThree { background-color: #35549A;
color: #FFC316;
width: 12%;
text-align: left;}
#three_element {margin: 0 auto; padding:0% 18.5% 0% 18.5%; text-align:center; }
.button-holder {
width: 250px;
height: calc(250px / 1.604);
margin: -1.45% 1.5% -1.65% 1.5%;
display:inline-block;
padding:5px;
box-sizing:border-box;
}
#addbutton {
border-radius: 25px 25px 25px 25px;
-moz-border-radius: 25px 25px 25px 25px;
-webkit-border-radius: 25px 25px 25px 25px;
display:table;
border: 0px;
box-sizing:border-box;
padding:0px;
margin:0px;
background-color:#E6E7E8;
text-align:center;}
#addbutton .add {
display: table-cell;
font-size: calc(250px / 1.604 - 50px);
color: #384D94;
width: 240px;
height: calc(240px / 1.604);
vertical-align: middle;
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
[class~=objective-edit-tile] {
width: 250px;
height: calc(250px / 1.604);
margin: 1.5%;
display:inline-block;
box-sizing:border-box;
padding:5px;}
[class~=objective-edit-tile] div {
font-family:"Yanone Kaffeesatz","Arial Narrow",Arial,sans-serif;
box-sizing:border-box;
color:#FFFFFF;
margin:0px;
display:inline-block;
}
.tr-1-square-red div {background-color: #BE1E2D;}
.tr-1-square-yellow div {background-color: #E39F15;}
.tr-1-square-green div {background-color:#266733;}
.text-block-name {
border-radius: 25px 25px 0px 0px;
-moz-border-radius: 25px 25px 0px 0px;
-webkit-border-radius: 25px 25px 0px 0px;
border:#FFFFFF 1px solid;
width: 100%;
height: 66.7%;
font-size: 180%;
padding-top:17%;
}
.text-block-days {
border-radius: 0px 0px 0px 25px;
-moz-border-radius: 0px 0px 0px 25px;
-webkit-border-radius: 0px 0px 0px 25px;
border-top: #FFF 1px solid;
font-weight:700;
width: 34%;
height: 33%;
padding-top:6.5%;}
.text-block-next-step {
border-radius: 0px 0px 25px 0px;
-moz-border-radius: 0px 0px 25px 0px;
-webkit-border-radius: 0px 0px 25px 0px;
border-top: #FFF 1px solid;
font-size:9px;
width: 64%;
height: 33%;
padding:8% 2px 0px 1px;}
</style>
</head>
<body>
<div id="main">
<div id="bar">
<div class="banner cellOne">Pipeline</div>
<div class="banner cellTwo"> <Title> </div>
<div class="banner cellThree">PracticePipeline.com</div>
</div>
<div role="content" id="three_element">
<div class="button-holder">
<button id="addbutton" name="buttton">
<span class = "add">+</span>
</button>
</div>
<div class = "tr-1-square-red objective-edit-tile" id="tile-n">
<div class = "text-block-name" >GGN </div>
<div class = "text-block-days" > -10 Days</div>
<div class = "text-block-next-step" >Research GGN background </div>
</div>
<div class = "tr-1-square-yellow objective-edit-tile " id="tile-n">
<div class = "text-block-name" >GGN </div>
<div class = "text-block-days" > -10 Days</div>
<div class = "text-block-next-step" >Research GGN background </div>
</div>
<div class = "tr-1-square-green objective-edit-tile " id="tile-n">
<div class = "text-block-name" >Stark Indust.. </div>
<div class = "text-block-days" > 7 Days</div>
<div class = "text-block-next-step" >Invite Stark Industri.. </div>
</div>
</div>
</div>
</body>
I dont know if this is going to help much but it worked when i tried it.
The tag padding-bottom keep making a little bit higher if you want it to align better.
#addbutton .add {
display: table-cell;
font-size: calc(250px / 1.604 - 50px);
color: #384D94;
width: 240px;
height: 140px;
vertical-align: middle;
margin: 0px;
padding: 0px;
box-sizing: border-box;
padding-bottom: 7%
}
I actually solved my own problem:
The problem was just that I was over analyzing things. Basic lay-outing worked:
.button-holder {
margin:1.5%;
display:inline-block;
padding:5px;
box-sizing:border-box;
}
#addbutton {
border-radius: 25px 25px 25px 25px;
-moz-border-radius: 25px 25px 25px 25px;
-webkit-border-radius: 25px 25px 25px 25px;
width: 240px;
height: calc(250px / 1.604 - 10px);
border: 0px;
margin:0px;
padding: 0px;
background-color:#E6E7E8;
box-sizing:border-box;
text-align:center;
}
#addbutton .add {
font-size: 97px;
color: #384D94;
}

Why dosn't my slider show up correct in firefox?

The slider at the top of my page does show up perfect in Chrome, but not in Firefox. How can I fix this problem?
I already uploaded a test of the page, in case you would like to have a look.
Test of page: http://www.s4ea.org/new/index.html
HTML:
<header class="header2">
<header class="second">
<div class="top_slider">
<div id="slider" class="aslider" data-duration="10" data-hide-controls>
<div class="aslide" data-duration="4" data-audio="assets/audio/Acoustic-Josh-10248_hifi.mp3" data-audio-loop>
<img src="https://lh6.googleusercontent.com/-kKIX7Bbp10U/UwlakWBTzII/AAAAAAAA1iU/FoYSNulL4Oo/s720/IMG_0003.JPG" />
</div>
<div class="aslide" data-duration="5" data-audio="assets/audio/Country_-Adrien_G-8614_hifi.mp3">
<img src="https://lh3.googleusercontent.com/-yRjbRGF3V5Q/UwlauwWKw-I/AAAAAAAA1jE/8EiHF1C5bvc/s720/IMG_0009.JPG" />
</div>
<div class="aslide" data-duration="6" data-audio="assets/audio/Driving_-SpoonZ-9705_hifi.mp3">
<img src="https://lh4.googleusercontent.com/-I0BvWvxsYos/Uwla55SXfeI/AAAAAAAA1j8/nH4M26dUtdw/s720/IMG_0016.JPG" />
</div>
<div class="aslide" data-duration="7" data-audio="assets/audio/I_Wouldn-duh-8326_hifi.mp3">
<img src="https://lh3.googleusercontent.com/-1OPZWOsQxTQ/UwlbHV7w9tI/AAAAAAAA1k0/FHocKwEtNuQ/s720/IMG_0023.JPG" />
</div>
</div>
</div>
<div class="logo">
<img src="http://www.s4ea.org/images/logor.jpg" width="100%" height="auto">
</div>
<div class="right">
<img src="http://www.s4ea.org/images/register3.jpg" height="100%" width="auto" />
</div>
</header>
</header>
CSS:
.ul {
width:50%;
list-style:none;
display:inline;
background-color:#FFF;
}
.ul li {
display: inline;
background-color:#FFF;
}
.second .top_slider {
width:40%;
background-color: #FFF;
float:left;
}
.second .top_slider .aslide {
display: none;
}
.second .top_slider .aslide img {
max-width: 100%;
height:auto;
}
.second .top_slider #slider {
width: 100%;
height: 600px;
}
.second .top_slider .aslide .text {
width: 200px;
margin: 0 auto;
color: #f8f8f8;
text-shadow: 0 0 2px #000;
font-weight: bold;
font-size: 36px;
width: 100%;
text-align: center;
position: absolute;
bottom: 30px;
font-family: sans-serif;
}
.second .logo {
width: 26.7%;
background-color: #FFF;
float:left;
padding-left:3.3%;
}
.second .right {
width:26.7%;
background-color: #FFF;
float:left;
overflow:hidden;
font-size:1em;
height:100%;
padding:0% 0% 0% 3.3%;
}
.second .right img {
margin:0px 0px 0px 0px;
width:100%;
height:auto;
}
.second .right ul li{
list-style:none;
line-height:0px;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
}
.second .right ul {
list-style:none;
line-height:0px;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
}
.second .right ul li img{
list-style:none;
line-height:0px;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
height: 20%;
padding-top:5%;
width:auto;
}
A couple of issues
.second .top_slider .aslide img {
width: 100%;
height:auto;
}
.mainheader nav {
background-color: #FFFFFF;
float: left;
height: 10%;
width: 100%;
}
it seems the width of the images are not correct since you did not set a width and your nav just needed a float clear. I cleared it by making it a float but there are many other ways to do this

Form labels/fields not being centered vertically

I am having trouble vertically centering my labels/fields in my form. I have centered the content horizontally but now would also like to add vertical centering. When I run my code i can see that the fieldset padding is off. The value of the padding on the top is less than the value on the bottom. I figure for the vertical centering to occur they should be equal. Here is my code...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Contact</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="contact.css">
</head>
<body>
<header id="pageHeader">
</header>
<nav class="mainNav">
<ul>
<li>Home</li>
<li>Photos</li>
<li>About</li>
<li>Contact</li>
</ul>
<img src="NewLogo3.png">
</nav>
<div class="contact">
<h1>Get In Touch</h1>
<form action="index.php" method="POST" >
<fieldset class="boxShadow">
<label>Name:</label>
<input type="text" name="name" placeholder="Enter your name" class="boxShadow"/>
<label>Email:</label>
<input type="email" name="email" placeholder="Enter your email address" class="boxShadow"/>
<label>Message:</label>
<textarea name="message" placeholder="What's on your mind?" class="boxShadow"></textarea>
<input type="submit" value="Send message" />
</fieldset>
</form>
</div>
<footer id="pageFooter">
<p>Thanks for visiting my website</p>
<span>&copy 2013</span>
</footer>
</body>
</html>
html, body, h1, h2 , ul, nav, img{
margin:0;
padding: 0;
font-size: 1em;
font-family: 'Roboto', sans-serif;
font-weight: 400;
}
body{
background: #777777;
height: 100%;
}
nav{
background: #40B3DF;
height: 100px;
font-size: 2em;
width: 100%;
border-bottom: 1px solid black;
}
nav ul{
position: absolute;
top: 55px;
white-space:nowrap;
margin-left: 100px;
}
nav li{
display: inline-block;
background: #A8CB17;
padding-bottom: 0;
border-radius: 8px 8px 0 0;
border-bottom: 2px solid #A8CB17;
margin-right: 10px;
-webkit-box-shadow: -5px 0px 7px 0px rgba(0,0,0,0.75);
-moz-box-shadow: -5px 0px 7px 0px rgba(0,0,0,0.75);
box-shadow: -5px 0px 7px 0px rgba(0,0,0,0.75);
}
nav a{
text-decoration:none;
color: #004158;
padding: 10px;
}
nav img{
position: absolute;
right: 50px;
top: 15px;
}
nav li:hover{
background: #17649A;
border-bottom: 2px solid #17649A;
}
p{
padding-top: 3em;
color: #454545;
text-align: center;
}
h1{
color: #393939;
font-size: 3em;
padding: 1em 0 0 1em;
text-shadow: 2px 2px 3px rgba(23, 23, 23, 1);
margin-bottom: 1em;
}
footer{
border-top: 2px solid #393939;
background: #40B3DF;
position:relative;
bottom:0;
height: 60px;
width: 100%;
text-align: center;
}
footer p{
display:inline-block;
margin: 0 auto;
padding-top: 1.5em;
color: #004158;
}
footer span{
position: relative;
top: 7px;
right: -45px;
}
textarea{
height: 150px;
width: 200px;
padding: 1em;
}
label, input[type=submit]{
text-transform: uppercase;
}
input, label{
display: block;
margin: 0 auto;
padding: 1em;
width: 200px;
}
input[type=submit] {
margin-top: 2em;
border-radius: 8px;
font-weight: 700;
}
fieldset {
height: 550px;
position: relative;
width: 60%;
text-align: center;
background: #676767;
margin: 0 auto;
margin-bottom: 2em;
/*border: 0;*/
}
The gap at the bottom of the form is due to the fact that your fieldset has a height of 550px, but your content does not fill that height. Remove the height, and adjust margin/padding from there.
As for the padding on the fieldset, browsers add padding to fieldsets by default. To make your site more consistent across browsers, use a CSS reset, like the HTML5 reset style sheet. That essentially overrides all of a browser's default styling. When using it, apply it above all of your other CSS styles. As for the padding itself, there are a few ways to manage it.
To adjust a certain side, you can use padding-top, padding-bottom, padding-right, or padding-left.
You can adjust top/bottom, left/right using padding: 10px 15px;, which would give you 10px on top and bottom, and 15px on the left and right.
You can also specify top, left/right, and bottom with padding:10px 15px 5px.
Margins are set the same way, just replace "padding" with "margin".

Slider covering mega drop down menu

If you could kindly hover your mouse over the MORE button in the menu here:
http://jsfiddle.net/H8FVE/3/
You will notice that the big wide picture underneath (#featured) is covering the drop down div. Why and how can I fix it?
Here is part of my HTML code:
<div id="second-menu" class="clearfix">
<ul id="secondary-menu" class="nav sf-js-enabled">
<li class="manimation">Animation</li>
</ul>
<ul id="mega">
<li class="dif mmore" style="background:none;">More...
<div>
<ticman>
<ul>
<li class="mgames">Games</li>
<li class="mliterature">Literature</li>
<li class="marts">Arts</li>
<li class="mcontact" style="background:none;">Contact</li>
</ul>
</ticman>
<h2>Classes</h2>
<p>TimesSchedualMap</p>
<p>NamesStudyDirections</p>
<p>HealthDanceBiology</p>
<h2>Teachers</h2>
<p>BillyMadeleineLaurenSteve</p>
<p>PaddingtonStefanMichaelMadeline</p>
<p>ShannonMaryRaffaelloLorence R</p>
<h2>Location</h2>
<p>CarlsbadOceansideEl Cajon</p>
<p>VistaLa CostaEncinitas</p>
<p>San DiegoLos AnglesCardiff</p>
</div>
</li>
</ul>
</div> <!-- end #second-menu -->
<div class="et_cycle" id="featured">
Previous
Next
<div id="slides" style="position: relative; background-image: none;">
<div class="slide" style="position: absolute; top: 0px; left: 0px; z-index: 3; opacity: 1; display: block;">
<img width="958px" height="340px" alt="10 moments in cinematic history changing faith" src="http://ftframes.com/delheat/wordpress/wp-content/uploads/et_temp/ip-man-donnie-yen-756651_958x340.jpg"> <div class="featured-top-shadow"></div>
<div class="featured-bottom-shadow"></div>
<div class="featured-description">
<div class="feat_desc">
<p class="meta-info">Posted by <a rel="author" title="Posts by admin" href="http://ftframes.com/delheat/wordpress/?author=1">admin</a> on Aug 9, 2012</p>
<h2 class="featured-title">Some random text here</h2>
<p>Well, I like this trailer a bit better than Chasing Mavericks’. Well for one, Gerry gets to keep his Scottish brogue, wahoo! Plus, I kind of like seeing him with kids. I mean the last time he played dad to a little boy was in the wonderful indie Dear Frankie, and he’s definitely a natural with them. Then there’s the supporting cast: Catherine Zeta-Jones, Jessica Biel, Uma Thurman, Dennis Quaid and...</p>
</div>
<a class="readmore" href="http://ftframes.com/delheat/wordpress/?p=43">Read More</a>
</div> <!-- end .description -->
</div> <!-- end .slide -->
<div class="slide" style="position: absolute; top: 0px; left: 0px; display: none; z-index: 2; opacity: 0;">
<img width="958px" height="340px" alt="More experimental testings" src="http://ftframes.com/delheat/wordpress/wp-content/uploads/2012/07/vlcsnap-2012-05-13-22h37m19s79-300x129.png"> <div class="featured-top-shadow"></div>
<div class="featured-bottom-shadow"></div>
<div class="featured-description">
<div class="feat_desc">
<p class="meta-info">Posted by <a rel="author" title="Posts by admin" href="http://ftframes.com/delheat/wordpress/?author=1">admin</a> on Jul 30, 2012</p>
<h2 class="featured-title">More experimental testings</h2>
<p>Lets see how this one turns out… Lets see how this one turLets see how this one turLets see how this one turLets see how this one turLets see how this one turLets see how this one turLets see how this one turLets see how this one tur
Lets see how this one turLets see how this one turLets see how this one turLets see how this one turLets see how this one turLets see how this one turLets see how...</p>
</div>
<a class="readmore" href="http://ftframes.com/delheat/wordpress/?p=10">Read More</a>
</div> <!-- end .description -->
</div> <!-- end .slide -->
<div class="slide" style="position: absolute; top: 0px; left: 0px; display: none; z-index: 1; opacity: 0;">
<img width="958px" height="340px" alt="Testing this theme with image" src="http://ftframes.com/delheat/wordpress/wp-content/uploads/et_temp/251932_10151043115229294_310983318_n-39277_635x340.jpg"> <div class="featured-top-shadow"></div>
<div class="featured-bottom-shadow"></div>
<div class="featured-description">
<div class="feat_desc">
<p class="meta-info">Posted by <a rel="author" title="Posts by admin" href="http://ftframes.com/delheat/wordpress/?author=1">admin</a> on Jul 30, 2012</p>
<h2 class="featured-title">Testing this theme with image</h2>
<p>And this is how it looks, very interesting indeed.And this is how it looks, very interesting indeed.And this is how it looks, very interesting indeed.And this is how it looks, very interesting indeed.And this is how it looks, very interesting indeed.And this is how it looks, very interesting indeed.And this is how it looks, very interesting indeed.And this is how it looks, very interesting...</p>
</div>
<a class="readmore" href="http://ftframes.com/delheat/wordpress/?p=6">Read More</a>
</div> <!-- end .description -->
</div> <!-- end .slide -->
</div> <!-- end #slides -->
</div> <!-- end #featured -->
And here is part of my CSS:
ul#secondary-menu li { background: url(images/secondary-menu-bg.png) repeat-y top right; }
ul#secondary-menu a { font-size: 16px; color: #48423f; text-decoration: none; text-transform: uppercase; font-weight: bold; padding: 22px 16px; }
ul#secondary-menu a:hover { color: #ffffff; text-shadow: 1px 1px 0 #404747; }
#second-menu ul.nav li:hover a {color: #ffffff; text-shadow: 1px 1px 0 #404747; }
ul#secondary-menu > li.current_page_item > a { color: #919e9e !important; }
ul#secondary-menu li ul, #category_mobile_menu { width: 360px !important; padding: 7px 0 10px; background: #fff url(images/content-bg.png); top: 55px !important; -moz-box-shadow:3px 3px 7px 1px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 3px 3px 7px 1px rgba(0, 0, 0, 0.1); box-shadow: 3px 3px 7px 1px rgba(0, 0, 0, 0.1); -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; border-top-left-radius: 0px;-moz-border-radius-topleft: 0px; border-top-right-radius: 0px; -webkit-border-top-left-radius: 0px; -moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; z-index: 9999px; display: none; }
ul#secondary-menu ul li, #category_mobile_menu li a { margin: 0 !important; padding: 8px 0 8px 30px !important; width: 150px; float: left; }
ul#secondary-menu ul li a, #category_mobile_menu a { padding: 0 !important; }
ul#secondary-menu li:hover ul ul, ul#secondary-menu li.sfHover ul ul { top: -8px !important; left: 180px !important; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
ul#secondary-menu ul li.even-item { background: none; }
.mfilm:hover{
background:#ea2e49 !important;
}
.mtv:hover{
background:#2589cf !important;
}
.mwebvideos:hover{
background:#5c58ac !important;
}
.manimation:hover{
background:#43cf61 !important;
}
.manime:hover{
background:#c142a5 !important;
}
.mmanga:hover{
background:#e77848 !important;
}
.mcomics:hover{
background:#e8eb05 !important;
}
.mwriters:hover{
background:#ff3c75 !important;
}
.mmore:hover{
background:#4b5571 !important;
}
.mliterature:hover{
background:#2c8f83 !important;
}
.mgames:hover{
background:#e34328 !important;
}
.marts:hover{
background:#cc226a !important;
}
.mcontact:hover{
background:#9395aa !important;
}
/* ---------- Mega Drop Down --------- */
ul#mega li { padding-right: 0px; background: url(images/secondary-menu-bg.png) repeat-y top right; }
#mega {
list-style:none;
font-weight:bold;
height:2em;
}
#mega li {
padding: 23px 0px;
background:#999;
border:0px solid #000;
float:left;
text-align:center;
position:relative;
}
#mega li:hover {
background:#eee;
border-bottom:0; /* border-bottom:0; and padding-bottom:1px; keeps <li> and <div> connected */
z-index:1; /* shadow above adjacent li */
}
#mega a { font-size: 16px; color: #48423f; text-decoration: none; text-transform: uppercase; font-weight: bold; padding: 22px 16px;}
ul#mega a:hover { color: #FFFFFF; text-shadow: 1px 1px 0 #404747; }
/* ----------- Hide/Show Div ---------- */
#mega div {
-moz-border-bottom-colors: none;
-moz-border-image: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background: none repeat scroll 0 0 #FFFFFF;
border-color: -moz-use-text-color #48423F #48423F;
border-right: 1px solid #48423F;
border-style: none solid solid;
border-width: 0 1px 1px;
font-weight: normal;
left: -999em;
margin-top: 1px;
position: absolute;
text-align: left;
width: 496px;
}
/* --------- Within Div Styles --------- */
#mega li:hover div {
left: -1px;
top: auto;
}
#mega li.dif:hover div {
left: -407px;
top: 72px;
}
#mega li.mmore:hover > a {
color: #FFFFFF; text-shadow: 1px 1px 0 #404747; /* Ensures hover on MORE remains */
}
#mega div h2 {
background: none repeat scroll 0 0 #999999;
clear: both;
float: left;
font-size: 1em;
margin: 10px 0 5px;
padding: 0 10px;
position: relative;
width: 300px;
}
#mega div ticman {
clear: both;
float: left;
position: relative;
margin-left:1px;
margin-right:1px;
width: 495px;
height: 74px;
background-image: url(images/morebgwide.png);
background-size:495px 74px;
background-repeat:no-repeat;
}
#mega div p {
float: left;
padding-left: 10px;
position: relative;
width: 106px;
}
#mega div p a {
clear: left;
float: left;
line-height: 1.4;
text-decoration: underline;
width: 100%;
}
#mega div a:hover, #mega div a:focus, #mega div a:active {
text-decoration: none;
}
/*------------------------------------------------*/
/*--------------[FEATURED SLIDER]-----------------*/
/*------------------------------------------------*/
#featured { position: relative; padding-bottom: 20px; margin-left: -1px; margin-right: -1px; }
a#left-arrow, a#right-arrow { position: absolute; top: 136px; width: 32px; height: 68px; text-indent:-9999px; }
a#left-arrow { background:url(images/left-arrow.png) no-repeat; left: -32px; }
a#right-arrow { background:url(images/right-arrow.png) no-repeat; right: -32px; }
.featured-top-shadow { background:url(images/featured-top-shadow.png) repeat-x; position: absolute; top:0px; left: 0px; width: 958px; height: 7px; }
.featured-bottom-shadow { background:url(images/featured-bottom-shadow.png) repeat-x; position: absolute; bottom:0; left: 0; width: 958px; height: 8px; }
.featured-description { position: absolute; width: 333px; height: 196px; top: 40px; right:54px; background:url(images/featured-description.png); padding: 27px 32px 40px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; }
.featured-description p.meta-info { font-family: Georgia, serif; font-style: italic; font-size: 12px; color: #747474; }
.featured-description p.meta-info a { text-decoration: none; color: #fff; }
h2.featured-title { font-family: 'Kreon', Arial, sans-serif; font-weight: lighter;font-size: 30px; text-shadow: 1px 1px 1px rgba(0,0,0,0.4); margin-top: -4px; }
h2.featured-title a { text-decoration: none; color: #ffffff; }
.featured-description p { color: #c9c8c8; text-shadow: 1px 1px 1px rgba(0,0,0,0.4); line-height: 19px; }
a.readmore { display: block; background: url(images/readmore.png); height: 27px; padding: 0 17px; color: #dfca81; font-size: 12px; line-height: 27px; position: absolute; bottom: 0px; right: 0px; text-shadow: none; }
#featured a.readmore { -moz-border-radius-bottomright: 10px;-webkit-border-bottom-right-radius: 10px; border-bottom-right-radius: 10px; }
#featured a.readmore:hover { color: #fff; }
Although, I would advice overlooking the fiddle for a visual presentation of the issue: http://jsfiddle.net/H8FVE/3/
I have been trying to wrap my head around this all day to a point where I almost set my hair on fire. Do you know how to solve this?
Use the z-index css attribute to visually layer objects like this in HTML regardless of your DOM tree. I would advise you to test your eventual implementation cross browser though, especially IE7. Damn you IE7 for the extra work you cause us all.
See http://jsfiddle.net/H8FVE/6/:
Just add
#second-menu{
z-index:4;position:relative;
}
That's because slide has z-index:3, so if you want to see second-menu, its z-index must be higher.
And you have to add position:relative too because z-index has no effect on elements with position:static.
Edit:
I have seen you have
#mega div{
left:-999em;
}
#mega li.dif:hover div {
left: -407px;
top: 72px;
}
I think it would be better like this:
#mega > li.dif > div{
display:none:
left: -407px;
top: 72px;
}
#mega > li.dif:hover > div {
display: block;
}
That's because if you set left:-999em; to #mega div, you suppose that it won't be shown because -999em is a lot. But if you want to hide it, isn't it better not to display it?
And I have added child selectors (>) because in the future maybe you will modify it and add more divs inside #mega > li.dif > div; and child selectors should be faster than descendant selectors.
Try this:
#mega li:hover {
background:#eee;
border-bottom:0; /* border-bottom:0; and padding-bottom:1px; keeps <li> and <div> connected */
z-index:10; /* shadow above adjacent li */
}
I changed the z-index to 10, instead of 1.
http://jsfiddle.net/H8FVE/5/
Give #second-menu a z-index of 3
Give "#mega div" a z-index of 2
Give #featured a z-index of 1

Chrome(Win) and Safari (OSX) look different for my html

I created a mock up here of some html and for some reason my site looks different on safari than how i want it to look on chrome. On chrome it looks correct but on safari on osx and on mobile phones it just looks a bit off and centered in random spaces. I am not sure how to make it so other browsers look like one?
You can see the difference here in chrome win and safari osx ( the first image chrome ) http://imgur.com/Z3kYG&SYZkW?full I just want it to look as it does on chrome but i cant figure out whats wrong with my code.
<div id="right-preview"><div id="background1"><div id="contentarea">
<h4 id="time">01:59 AM</h3><br/><h4 class="username">Enter a name..</h3><div id="conversation"><div class="gBoxTall">
<div class="right">
<p class="message"> Your mom and I are going to divorce next month.</p>
</div>
<div class="bottom">
<div class="right"></div>
</div>
</div><div class="wBoxTall">
<div class="right">
<p class="message"> Why ? Call me please.</p>
</div>
<div class="bottom">
<div class="right"></div>
</div>
</div><div class="gBoxTall">
<div class="right">
<p class="message"> I wrote Disney and this phone changed it.</p>
</div>
<div class="bottom">
<div class="right"></div>
</div>
</div></div>
</div></div>
This is my CSS code as well.
* {
margin: 0;
padding: 0;
}
h1 a {
color: black;
text-decoration: none;
}
#background1 {
background-color:#09F;
height: 720px;
margin: 0px auto 0;
overflow: hidden;
position: relative;
width: 480px;
}
#background2 {
background-color:#09F;
height: 720px;
margin: 0px auto 0;
overflow: hidden;
position: relative;
width: 480px;
}
h4#time {
font-size: 18px;
text-align: center;
text-shadow: 0 -1px 0 #FFF;
padding-top: 4px;
}
.username {
text-align: center;
text-shadow: 0 -1px 0 #000;
font-size: 26px;
color:#FFF;
padding-top: 5px;
}
#conversation {
padding-top: 15px;
}
h3#date {
color: #808080;
font: bold 26px Helvetica, Arial, sans-serif;
text-align: center;
}
p.message {
font: 22px/25px Helvetica, Arial, sans-serif;
}
.gBoxTall {
background-color:#0C0;
clear: both;
float: right;
margin-top: 15px;
max-width: 270px;
padding-left: 22px;
}
.gBoxTall .right {
background-color:#0C0;
}
.gBoxTall .right p {
margin-left: -5px;
padding: 8px 30px 0 0;
color:#000;
text-shadow: 0px 0px 0px;
}
.gBoxTall .bottom {
background-color:#0C0;
height: 20px;
margin: -10px 0 0 -22px;
}
.gBoxTall .bottom .right {
background-color:#0C0;
float: right;
height: 20px;
width: 43px;
}
.wBoxTall {
background-color:#999;
clear: both;
float: left;
margin-top: 15px;
max-width: 260px;
padding-left: 33px;
}
.wBoxTall .right {
background-color:#999;
}
.wBoxTall .right p {
margin-left: -5px;
padding: 8px 24px 0 0;
color:#000;
text-shadow: 0px 0px 0px;
}
.wBoxTall .bottom {
background-color:#999;
height: 20px;
margin: -10px 0 0 -33px;
}
.wBoxTall .bottom .right {
background-color:#999;
float: right;
height: 20px;
width: 27px;
}
#contentarea {
font-family: Helvetica, Arial, sans-serif;
height: 660px;
overflow: hidden;
}
Your h4 tags are closed with h3 tags - this is invalid. Based on your CSS the line should probably be:
<h4 id="time">01:59 AM</h4><br/><h3 class="username">Enter a name..</h3><div id="conversation"><div class="gBoxTall">