我需要设置一个动态页面是asp.net,我的代码是
HtmlGenericControl timeliner = new HtmlGenericControl("div");
timeliner.Attributes.Add("id", "timelineContainer");
HtmlGenericControl expandall = new HtmlGenericControl("div");
expandall.Attributes.Add("class", "timelineToggle");
HtmlGenericControl para = new HtmlGenericControl("p");
HtmlGenericControl asec = new HtmlGenericControl("a");
asec.Attributes.Add("class", "expandAll");
asec.InnerText = "+ expand all";
para.Controls.Add(asec);
expandall.Controls.Add(para);
timeliner.Controls.Add(expandall);
HtmlGenericControl bline = new HtmlGenericControl("br");
bline.Attributes.Add("class","clear");
HtmlGenericControl tlm1 = new HtmlGenericControl("div");
tlm1.Attributes.Add("class", "timelineMajor");
HtmlGenericControl tlmm1 = new HtmlGenericControl("h2");
tlmm1.Attributes.Add("class", "timelineMajorMarker");
HtmlGenericControl span = new HtmlGenericControl("span");
span.InnerText = "1955";
HtmlGenericControl dl = new HtmlGenericControl("dl");
dl.Attributes.Add("class", "timelineMinor");
HtmlGenericControl dt = new HtmlGenericControl("dt");
dt.Attributes.Add("id", "32323");
HtmlGenericControl dla = new HtmlGenericControl("a");
dla.InnerText = "Test title";
dt.Controls.Add(dla);
dl.Controls.Add(dt);
tlmm1.Controls.Add(span);
tlm1.Controls.Add(tlmm1);
tlm1.Controls.Add(dl);
timeliner.Controls.Add(bline);
timeliner.Controls.Add(tlm1);现在,对于id为"timelineContainer“的第一个控件" div”,我有一个css给它一个左边框,使用这个代码,我的时间线显示得很好,除了左边框,由于某些原因,这个div的高度只有40px,因为它应该是所有孩子的父级。有什么想法吗?
发布于 2013-08-02 01:10:48
高度将不会作为父高度。不会增加。它只适用于宽度。如果您隐式设置了父容器的高度,则可以设置height: inherited。
<div id="parent" style="width: 200px">
<div id="child" style="width: inherited"></div>
</div>https://stackoverflow.com/questions/18000302
复制相似问题