My question is almost stupid because I think I know the answer but I wanna be sure. Does it exist a mechanism to be able to put a tag at a specific location. I mean, I can set the coordinates X and Y of a tag. Maybe this specific tag should be placed in a special parent tag?
Do you know an another way to do this?
An example should be something like this :
<html>
<body>
<div id="container" >
<img src="..." x="40" y="0" />
<img src="..." x=70" y ="10"/>
....
</div>
....
Many thanks for you atten开发者_运维知识库tion,
Bat
Well, if you want an element to be placed at a specific location on the page, you can give it position: absolute
in CSS, together with it's position relative to the last parent element that has a position value of relative
or absolute
.
For instance, with this HTML
<div id="square"></div>
Can be placed 100px off the top and left of the page with this CSS
#square {
width: 100px;
height: 100px;
position: absolute;
top: 100px;
left: 100px;
}
Given your example, no, not entirely. You can use the style
attribute for the same effect though:
<div id="square" style="top: 100px; left: 100px;"></div>
Assuming #square
has position: absolute
applied to it from a stylesheet already. It's best however if you incorporated this into a stylesheet, since content and presentation should be separate.
You can do absolute positioning via CSS. See http://css-discuss.incutio.com/wiki/Absolute_Layouts
精彩评论