Jump to content

HTML clock

stefanmz
Go to solution Solved by stefanmz,

anyway clock is done. I figured it out. moral of story:don't use px use %

 

hey so I am making a clock and I positioned my arrows to be in the center of it and now I am going to use transform:rotate to rotate and animate them but I used transform-origin to set the axis around which they rotate(the point). However they still rotate freely not around that point. why is that?
/*HTML*/
<div id="Clock">
		<img src="clockface.jpg">
		<hr id="seconds">
		<hr id="minutes">
		<hr id="hours">
	</div>
/*CSS*/
*{
	margin: 0px;
	padding: 0px;
}
img{
	height: 300px;
	border: 10px solid black;
	border-radius: 50%;
	margin-left: 10px;
	margin-top: 10px;	
}
#Clock{
	width: 300px;
	height: 300px;
}
#seconds{
	background: red;
	height: 1px;
	border: 0px;
	width: 100px;
	position: absolute;
	top: 170px;
	left: 170px;
}
#minutes{
	background: black;
	height: 2px;
	border: 0px;
	width: 50px;
	position: fixed;
	top: 148px;
	left: 157px;
	transform-origin: 26px 3px;
	transform: rotate(-60deg);
	
}

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

I looks like you are only trying to rotate the minutes, is that correct? Often times transform-origin has issues with being in a certain CSS style card. It is also good form to do something like

-moz-transform-origin: 26px 3px;
-ms-transform-origin:  26px 3px;
-o-transform-origin: 26px 3px;
-webkit-transform-origin:  26px 3px;
transform-origin: 26px 3px;

to allow for more browser compatibility. 

i5 4670k| Asrock H81M-ITX| EVGA Nex 650g| WD Black 500Gb| H100 with SP120s| ASUS Matrix 7970 Platinum (just sold)| Patriot Venom 1600Mhz 8Gb| Bitfenix Prodigy. Build log in progress 

Build Log here: http://linustechtips.com/main/topic/119926-yin-yang-prodigy-update-2-26-14/

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, CJPowell27 said:

I looks like you are only trying to rotate the minutes, is that correct? Often times transform-origin has issues with being in a certain CSS style card. It is also good form to do something like


-moz-transform-origin: 26px 3px;
-ms-transform-origin:  26px 3px;
-o-transform-origin: 26px 3px;
-webkit-transform-origin:  26px 3px;
transform-origin: 26px 3px;

to allow for more browser compatibility. 

hmm tried but same thing

 

Link to comment
Share on other sites

Link to post
Share on other sites

anyway clock is done. I figured it out. moral of story:don't use px use %

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×