Solved

CSS3 - transitions

Posted on 2012-07-31
4
739 Views
Last Modified: 2012-08-01
Hi

I have created a very simple HTML page with some very simple CSS3 properties in it.

Basically I want the page to act and perform like it does in Mozilla Firefox/Safari - but for some reason Chrome stands out.

Please take a look at http://bitspand.dk/csstest.html

When loading the page in these browsers - this is what happens:

Safari, Firefox: Loading the page shows no animation. Only when I hover the mouse over the black area with the text, then a transition comes alive - just like I want it.

Chrome: Loading the page starts with an animation - where the black area slides in from left to bottom, and then waits for the user to hover their mouse over the black area.

I DON'T WANT THE ANIMATION WHEN THE PAGE LOADS :(

Here is my HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/csstest.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="transition">
<div class="content">
<div class="contentTXT">Halloje - dette er en test</div>
<div class="contentTXT">Halloje - dette er en test</div>
<div class="contentTXT">Halloje - dette er en test</div>
<div class="contentTXT">Halloje - dette er en test</div>
<div class="contentTXT">Halloje - dette er en test</div>
<div class="contentTXT">Halloje - dette er en test</div>
<div class="contentTXT">Halloje - dette er en test</div>
<div class="contentTXT">Halloje - dette er en test</div>
</div>
</div>

</body>
</html>

Open in new window


Here is my CSS code:
@charset "utf-8";
/* CSS Document */

.transition {
	z-index: 1;
	background-color: #ffffff;
	background-image:url(../images/CRW_2063.jpg);
	float: left;
	height: 450px;
	width: 700px;
	position: relative;
	overflow:hidden;
}

.content {
	z-index: 2;
	position: relative;
	height: 450px;
	width: 700px;
	top: 350px;
	background-color: #000;
	opacity: 0.6;
	filter: alpha(opacity = 60);
	overflow: hidden;
	-webkit-transition: all 1s linear 0.5s;
	-moz-transition: all 1s linear 0.5s;
	-ms-transition: all 1s linear 0.5s;
	-o-transition: all 1s linear 0.5s;
	transition: all 1s linear 0.5s;
}

.contentTXT {
	position:relative;
	float:left;
	width:700px;
	height:50px;
	font-family: Arial;
	font-size: 30px;
	font-color: #FFF;
	z-index: 3;
	text-align: center;
	vertical-align: central;
	color: #FFF;
}
.content:hover {
	top: 0px;
	bottom: 0px;
}

Open in new window

0
Comment
Question by:jensjakobsen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 38244177
try using the html5 doctype and see if that helps.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Untitled Document</title>
<link href="css/csstest.css" rel="stylesheet" type="text/css" />
</head>
0
 
LVL 1

Author Comment

by:jensjakobsen
ID: 38245048
It worked!

Why did it work?
0
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 500 total points
ID: 38245470
transitions were introduced in CSS3, which was introduced around the same time as HTML 5. XHTML doesn't fully understand all the CSS3 rules.
0
 
LVL 1

Author Closing Comment

by:jensjakobsen
ID: 38245616
Fix and explanation - thx.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

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

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

Join & Ask a Question