如何在顶部获取div对象

I'm using the following code

<?php
$link= $_SERVER['HTTP_HOST'];
echo "<div id='link' style='position: relative; margin: 60 auto; width: 70%; top: -10px;
height: 100%;'>{$link}";

?>

The code works fine but I have other content on the page. This makes the above code move my content down the page or up depending on how I set up the margin.

What I want to do is to have my echo text to appear over my content.

Any help would be appreciated.

Use position:absolute;

<?php
$link= $_SERVER['HTTP_HOST'];
echo "<div id='link' style='position: absolute; width: 70%; top: 0px;
height: 100%;'>{$link}</div>";
?>

Probably your best bet here is to use position: absolute instead of relative. Push the rest of the content down some with a margin if you need to adjust it's spacing compared to the div.

Make sure to set a left: and top: attribute to ensure cross-browser consistency.