0

为什么当我将鼠标放在图像顶部时,它的大小没有改变?

我在 ASP 网页上有这个:

<asp:Image ID="ProdImage" CssClass="ImgDetail" runat="server" />

Page_Load() 像这样加载图像的 URL:

ProdImage.ImageUrl = ResolveUrl("~/Images/Products/" + lblProductID.Text + ".jpg");

CSS ImgDetail 类如下所示:

.ImgDetail
{
    width: 180px;
    height: auto; 
}

.ImgDetail:hover
{
    width: 360px;
    height: auto; 
}

我只想在鼠标位于图像顶部时更改图像大小。

谢谢你。

4

2 回答 2

0

Kind of solved the problem thanks to @Richthofen idea.

I checked the local CSS file (http://localhost:4290/Styles/Site.css) during debugging and it didn't have my changes on it.

Visual Studio 2010 doesn't update the CSS file when I start its debuger (F5). However, it updates the CSS file if I publish the webpage.

These are the properties of the CSS file on the Visual Studio 2010:

Build Action: Content

Copy to Output Directory: Copy always

Closing and opening VS 2010 didn't fix it. I had to reboot my PC for the CSS file to have my changes on debugging. I'm affraid I have to reboot my PC every time I need to debug the CSS file unless anyone knows how to fix this issue.

Thank you.

于 2013-05-10T15:04:46.743 回答
0

我要采取的第一个调试步骤是确认您正在应用的任何 css 样式都可以正常工作。所以给 .ImgDetail 一个 1px 边框红色什么的。如果您在页面加载时看不到它,则表示您的 CSS 文件未包含在内,这是一个常见错误。

于 2013-05-09T20:18:21.330 回答