Reputation: 3977
I have a Web app that is producing HTML roughly like this:
<div id="container">
<span>Header</span>
<div id="element">
<img src="something"/>
</div>
<span>Version 1.0</span>
</div>
looking roughly like this:
Server-side processing gives me coordinates within the image that I'd like to highlight (say, by drawing a red box on top of the image). What I'm hoping to do is something like:
<div id="container">
<span>Header</span>
<div id="element">
<img src="something"/>
<div id="highlight" style="width:30px;height:10px;top:10px;left:10px"/>
</div>
<span>Version 1.0</span>
</div>
(where the coordinates are generated in the HTML source by the server) looking roughly like this:
with:
#highlight: {
position: absolute;
border: 2px solid red;
}
#element: {
position: relative;
}
But instead I'm getting:
where the last span is inside the element that was just closed. What am I missing?
Update
I edited the question to get rid of a typo, but left in the error that was actually causing the problem.
Upvotes: 0
Views: 1382
Reputation: 14172
Lots of errors!
<div id="highlight" style="width:30px;height:10px;top:10px;left:10px!!!!!/>
Missing end quote:
<div id="highlight" style="width:30px;height:10px;top:10px;left:10px"/>
A div cannot close itself:
<div id="container">
<span>Header</span>
<div id="element">
<img src="something"/>
<div id="highlight" style="width:30px;height:10px;top:10px;left:10px"!!!!/>
</div>
<span>Version 1.0</span>
</div>
Fixed:
<div id="container">
<span>Header</span>
<div id="element">
<img src="something"/>
<div id="highlight" style="width:30px;height:10px;top:10px;left:10px"></div>
</div>
<span>Version 1.0</span>
</div>
Upvotes: 1