Visual Studio 2010:定位 ASP NavigationMenu 控件
我之前已经定位过
标签。我总是更喜欢绝对
定位。对于这个新项目,我想从 Visual Studio 2010 中的网站项目开始。
除了名为 NavigationMenu
的 asp:Menu 控件的定位之外,一切似乎都按照我的指示进行。 Visual Studio 放置在我的 Site.Master 文件中。
在GUI中,NavigationMenu
表明它的CssClass
属性是“menu”,但在Visual Studio创建的“Styles/Site.css”文件中,我没有看到在 Menu
或 NavigationMenu
下定义的任何内容。有一个 div.menu
定义,我已将其设置为使用 left: 0px;
,但是 NavigationMenu
继续*尝试我的耐心(通过将其自身置于我放置的
标记内。到目前为止,我已经尝试过这个:
div.menu {
left: 0px; height:400px;top:100px;width:150px;
}
this:
div.menu {
left: 0px; height:400px;top:100px;width:150px;vertical-align:top;
}
和 this:
div.menu {
left: 0px; height:400px;top:100px;width:150px;vertical-align:text-top;
}
没关系。继续漂浮在中间
标记。我没有重命名此 asp:Menu 控件。
有人可以告诉我此控件的定位定义在哪里吗?在我发疯之前控制一下?
评论:忘记添加以下内容:
div {
position:absolute;
}
I've positioned <div>
tags before. I always prefer absolute
positioning.
For this new project, I thought I'd start with a website project in Visual Studio 2010.
Everything seems to be doing what I tell it to do except for the positioning of an asp:Menu control called NavigationMenu
that Visual Studio placed in my Site.Master file.
In the GUI, the NavigationMenu
indicates that it's CssClass
property is "menu", but in the "Styles/Site.css" file that Visual Studio created, I do not see anything defined under either Menu
or NavigationMenu
. There is a div.menu
definition, that I have set to use left: 0px;
, but NavigationMenu
continues to *try my patience( by centering itself inside the <div>
tag that I have placed it in.
So far, I have tried this:
div.menu {
left: 0px; height:400px;top:100px;width:150px;
}
this:
div.menu {
left: 0px; height:400px;top:100px;width:150px;vertical-align:top;
}
and this:
div.menu {
left: 0px; height:400px;top:100px;width:150px;vertical-align:text-top;
}
It does not matter. The NavigationMenu
continues to float in the middle of the <div>
tag.
I have not renamed this asp:Menu control. Is is the "out of the box" version that Visual Studio 2010 creates.
Could someone tell me where the positioning definitions are for this control before I go mad?
Comment: forgot to add this:
div {
position:absolute;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我之前在设计 asp 元素时遇到过一些问题。我的解决方案是将样式直接放置在 asp 元素定义中。
类似的东西。
当您需要设置 div 和菜单的位置属性时,也可能会出现此问题。
这是有关 CSS 定位示例的好读物。
http://www.barelyfitz.com/screencast/html-training/css/定位/
I have had some problems styling asp elements before. The resolution for me was to place the styles directly in the asp element definition.
something like.
The problem may also be occuring as you need to set the position property for both the div and the menu.
This is a good read for examples of CSS positioning.
http://www.barelyfitz.com/screencast/html-training/css/positioning/