I have a CSS style sheet that has the following:
div.box img {
width:100px;
height:100px;
border:1px solid;
display:inline;
}
This div tag basically re-sizes my image. My HTML file has the following:
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript">
function doMove(){
//move object
}
</script>
</head>
<body>
<h1>JavaScript Animation</h1>
<div class="box">
<img src="dp.png"/>
</div>
I want to be able to move this box to the left once doMove() is called. How do i refer to my DIV tag in my stylesheet in javascript?
Assuming that you want only the
divwith the class-name ofbox:JS Fiddle demo.