当我使用相对定位时,Div标签不显示 [英] Div tag not showing when I use relative positioning

查看:56
本文介绍了当我使用相对定位时,Div标签不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在vb.net的VS 2012工作。和asp.net 4.5。我正在使用div对一些控件进行分组。当条件满足时,我想在屏幕上移动div和控件。我在后面的代码中使用了:div1.Attributes.Add(style,position:relative; left:0px; top:0px)。在aspx页面中我有:< div runat =serverstyle =border:thin solid#000000; background-color:#ECE4C5id =div1height =50pxalign =center>控件向上移动,但控件周围的框架和背景颜色不显示。我希望我解释了我想要达到的目标,以便有人理解。任何帮助将不胜感激。这不是功课。我已经失学多年了。



非常感谢,



D-Bar

解决方案

不要添加新的样式属性,而是编辑现有属性。尝试:

 div1.Attributes(  style)& =   position:relative; left:0px; top:0px; 


Hi all, I am working in VS 2012 with vb.net. and asp.net 4.5. I am using a div to group some controls. When a condition is met I want to move the div and controls in div up the screen. I used: div1.Attributes.Add("style", "position:relative; left:0px;top:0px") in the code behind. In the aspx page I have: <div runat="server" style="border: thin solid #000000; background-color: #ECE4C5" id="div1" height="50px" align="center"> The controls move up, but the frame around the controls and the background color do not show. I hope I explained what I am trying to accomplish well enough so someone will understand. Any help would be greatly appreciated. This isn't homework. I have been out of school for ages.

Thank-you very much,

D-Bar

解决方案

Instead of adding a new style attribute, edit your existing one. Try:

div1.Attributes("style") &= "position:relative;left:0px;top:0px;"


这篇关于当我使用相对定位时,Div标签不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆