View Full Version : Need to know some code...
clarky3429
03-15-2006, 10:49 PM
ok, im doing some assignment thing, and the question says;
"use an object tag to display an imae in the center (horizontally) of the page"
what would the code be for that, keeping in mind only the object tag can be used???
mark87
03-15-2006, 10:57 PM
We're not here to do your homework for you... http://www.w3schools.com/tags/tag_object.asp will get you started.
clarky3429
03-15-2006, 11:22 PM
i know that your not, its just that I cant get it to center, i can do the object and display the image, it just wont centre
greasonwolfe
03-15-2006, 11:28 PM
It might help if you show the code you have. There are plenty of people here capable of helping, but they are omniscient and cant send their minds through the internet to see how you've coded this up. But damn, that would be a neat trick if they could, it would save me hours in coming here to ask questions.
Anyways, back to the point. It is hard to help without seeing the code you are using. You may only need one line, you may only need to fix one little thing, but without seeing the code nobody knows exactly how you are going about it.
clarky3429
03-15-2006, 11:36 PM
<html>
<head>
<title>Exercise 2 ##</title>
</head>
<body>
<OBJECT DATA="image.jpg" TYPE="image/jpg" align="center"></OBJECT>
</body>
</html>
that is what I have so far and it doesnt work, lol
greasonwolfe
03-15-2006, 11:50 PM
Well let's see,
Even though I am not big on using objects myself, I understand enough about them to wonder why your assignment would ask you to use object tags for an image, but apparently your teacher has some purpose in mind.
All that not withstanding, it would appear that "center" is not an acceptable value for the "align=" attribute of an object (someting I learned from that fine link that mark provided).
There are a number of ways you could go, however. You could use styling to position it (in line with current standards and recommendations) or you could do things the old fashioned way and drip it into a table. Either route, however, is going to require that you determine the screen size and calculate a top and left position for the object in question when you display it.
If I could be of more help, I would, but in this instance, I am going to have to defer to those more knowledgable than I. Hopefully this will get you headed in a direction that will ultimately result in achieving your goal.
clarky3429
03-16-2006, 12:01 AM
it seems by that page, yes that using center align wont work.
<P ALIGN=center><OBJECT DATA="image.jpg" TYPE="image/jpg"></OBJECT></P> will work, but its not using just the object tag, but other than that, i dont see any other way
_Aerospace_Eng_
03-16-2006, 12:11 AM
You would need to use some CSS if the only truly thing on the page is to be the object tag which I don't think it is. Do you know CSS?
if the object is inside a container or someting of fixed size.. you can use the attribute "hspace" to position it horizontaly, a quick example using a basic table, cause im not about to write some css for an example, lol.
<html>
<head>
<title>Exercise 2 ##</title>
</head>
<body>
<table bgcolor="#6699cc" width="600" align="center">
<tr>
<td>
<OBJECT DATA="image.jpg" TYPE="image/jpg" hspace="300"></OBJECT>
</td>
</tr>
</table>
</body>
</html>
you can use hspace outside of a container but its value can only be defined with pixels and not percentages, thus without a container it would be difficult for it to be centered under all circumstances.
clarky3429
03-16-2006, 12:34 AM
yeah i know CSS, but for some reason it was only allowed to be using a object tag. no matter, ive sent it off anyways, thanks everyone for helping me, probobly saved me 5 hours of trying commands that you all know wouldnt work, lol :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.