Asp.net 在Windows 7上向左移动的图像
最近,我的公司迁移到了Windows7操作系统 我在Windows XP机器上使用Visual Studio 2010中的以下主文件,一切正常,现在我将以下代码迁移到Windows 7和相同的Visual Studio 2010,下面的所有图像都移到左侧。我可以调整它们,但我很好奇为什么所有的图像都移到左边,我使用的是同一个显示器,而VisualStudio2010版本是相同的Asp.net 在Windows 7上向左移动的图像,asp.net,html,css,Asp.net,Html,Css,最近,我的公司迁移到了Windows7操作系统 我在Windows XP机器上使用Visual Studio 2010中的以下主文件,一切正常,现在我将以下代码迁移到Windows 7和相同的Visual Studio 2010,下面的所有图像都移到左侧。我可以调整它们,但我很好奇为什么所有的图像都移到左边,我使用的是同一个显示器,而VisualStudio2010版本是相同的 <%@ Master Language="C#" AutoEventWireup="true" Code
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Login.master.cs" Inherits="Masters_Login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../App_Themes/NG/style.css" rel="Stylesheet" type="text/css" />
<style type="text/css">
div ,
div img { display:block }
.fl
{
float:left;
margin-left:15%;
background-color:#8e2826;
width:68.1%;
margin-right:18%;
text-align:center;
}
.f2
{
float:left;
margin-left:15%;
background-color:#e5e0dd;
width:68.1%;
margin-right:18%;
text-align:center;
}
.f3
{
float:left;
margin-left:15%;
background-color:#d4cfcd;
width:68.1%;
margin-right:18%;
text-align:center;
}
.style1
{
color: #8e2826;
}
</style>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body >
<form id="form1" runat="server" >
<div style="margin-left:15%; background-color:#343434; width: 68.1%; margin-right:18%; ">
<asp:Image ID="imgIS" ImageUrl="~/images/improved_LOGO.jpg" runat="server" />
</div>
<div class="fl" >
<asp:Image ID="imgTop" runat="server" ImageUrl="~/images/m_banner_top.jpg" />
</div>
<div class="f2">
<asp:Image ID="Image2" runat="server" ImageUrl="~/images/m_banner_btm_5.jpg" />
</div>
<div class="f3" ></div>
<div class="f3">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div style="margin-left:15%; margin-right:18%; width: 68.1%; background-color:#8e2826; text-align:center">
<asp:Image ID="banner" runat="server" ImageUrl="~/images/b_banner_calibri.jpg"/>
</div>
</form>
</body>
</html>
如果要将它们与页面中心对齐,请在CSS中添加以下行:
width://fixed width;
margin-left: auto;
margin-right:auto;
你有float:left代码>在.fl
和.f2
中设置,均设置为div
s,其中包含图像。您的DOCTYPE
似乎也不完整:这是原因之一,因为我反对使用ASP.net和Visual Studio—不懂HTML的人开始“编写代码”,而不遵守任何标准。不是个人冒犯。如果要将它们与页面中心对齐,必须在CSS中指定: