<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="WebApplication5.WebForm4" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 <head runat="server">
     <title></title>
     <style type="text/css">
         .aa          {
 position: absolute;
 font-family:宋体;
color: Red;
 font-size:10pt;
 text-align: center;
 cursor:hand;
         }
 .a2         { position: absolute; font-family: 宋体; font-size: 10pt; color: #FFFF00; width: 65px; height: 14px;text-align: left }
 .a1         {
 position: absolute;
 width: 28px;
 height: 16px;
 font-family:宋体;
color:#FFFF00;
 font-size:10pt;
 text-align:left;
 }
 </style>
 <script  type="text/javascript" language="JavaScript">
 <!--
         function FP_goToURL(url) {//v1.0
             window.location = url;
         }
         function qxt(as_id) {
             window.open("qxt.asp?name='" + as_id + "'&dxbh='001'", "", "menubar=no,toolbar=no,scrollbars=yes,titlebar=no,resizable=yes,width=800,height=450")
         }
 
// -->
 </script>
 </head>
 <body>
 <p align="center">
 <img alt="0" border="0" name="001" src="img/ftb_sq_xhs.jpg"/></p>
 <script type="text/javascript" language="javascript" >
 <!--
     var imgWidth = document.all; 001; width;
     var imgheigth = document.all;001;
     var width;
     screenW = screen.width;
     width = (screenW - imgWidth) / 2 - 8
     document.writeln('<div id="Layera" style="position:absolute; width:10px; height:10px; z-index:135;left: ' + width + ';top: 0px">')
 //-->
 </script>
 <div class="aa"
         style="z-index: 36; left: 373px; top: 222px; width: 53px; height: 17px;" 
         id="wendu">
工程图</div>
  <form id="form1" runat="server">
     </form>
     </body>
 </html>
 想让“工程图”这三个字 和我我需要的一些数据标在图片上 我用vs2010中的asp.net在编辑框里还可以对齐呢 可以一运行 就错位了 那位大神帮着给改正一下 
 就是想在背景图片上(ftb_sq_xhs.jpg)写一些数据 我用的分层 图片上加的层 好像定位不对 但是不会了 求改正  JavaScriptHTML

解决方案 »

  1.   

    下面主题内容这样写
    <div class="bg">
    <div class="aa">工程图</div>
    </div>上面的样式
    <style type="text/css">
    .bg {width:100%; height:auto; float:left; clear:both; background:url(/img/ftb_sq_xhs.jpg) no-repeat}
    .aa{width:100%; height:200px; float:left}
    <style>宽高你自己调整,结构就是这样的。
    css应该独立写成一个文件,然后引用。 
    你还是学学布局吧。
    实在不会就用table  外面的table设置一个背景图片,里面套一个table 放你的工程图
      

  2.   

    我觉得在div里面还得加一个样式属性 position:absolute
      

  3.   

        <div style="width: 400px; height: 400px; position: relative; background-image: url(images/banner1.jpg)">
            <div style="width: 100px; height: 20px; position: absolute; top: 50px; left: 100px; background-color:#fff;">
                这里是相对定位(50,100)
            </div>
        </div>
      

  4.   

    5楼的 大哥 您写的代码 没有调用上边的css啊 我刚实验了一下 还是不行啊 效果还是和我上边的一样 在代码区把数据标在图片上 一运行 还是错位 您看看 哪里还需要改一下啊 我都好几天了 也没研究出来 css布层 我还不太会
      

  5.   

    不知这样如何?
    <div class="a2" style="background-image:url('工程图');z-index: 36; left: 373px; top: 222px; width: 53px; height: 17px;">
    <div class="a1">这是数据</div>
    </div>
      

  6.   


    你新建一个测试页,只保存我的那几行代码,应该是没问题的
    嗯 大神 你说 我如果想在(“这里是相对定位”)这几个字的地方连数据库 怎么写代码呢 能用css吗? 就是想 在运行后 点击网页上的这几个字 然后直接连到后台的数据库 怎么设置啊 感激ing!! 加分