Image 如何在我的代码中创建自定义换行符
我在C#中有以下代码,它从db打印图像。通过这些代码,图像和单选按钮在单行中显示单个时间。这是我的代码Image 如何在我的代码中创建自定义换行符,image,c#-4.0,radio-button,Image,C# 4.0,Radio Button,我在C#中有以下代码,它从db打印图像。通过这些代码,图像和单选按钮在单行中显示单个时间。这是我的代码 foreach (DataRow item in ds.Tables[0].Rows) { divs += @" <div style="" position:relative; height:100px; width:400px; margin:10px auto;""> <d
foreach (DataRow item in ds.Tables[0].Rows)
{
divs += @" <div style="" position:relative; height:100px; width:400px; margin:10px auto;"">
<div style=""position:absolute; width:80px; height:80px; top: 10px; left: 130px;"">
<a href=""#"" class=""screenshot"" rel=""images/"+item["namee"].ToString()+@".jpg"" ><img src=""images/" + item["namee"].ToString() + @".jpg"" width=""80px"" height=""80px"" /></a>
</div>";
if(id < 1){
divs += @" <div style=""position:absolute; width:231px; left:240px; top:35px; height: 40px;"">
<p style="" margin-top:10px; margin-left:20px; ""><input type=""radio"" name=""SSRI"" value=""" + item["namee"].ToString() + @""" /></p>
</div>";
}
divs += @"<div style=""position:absolute; width:231px; left:100px; bottom:10px; height: 40px;"">
</div>
</div>";
}
Response.Write(divs);
但是我想把它弄出来,b应该这样吗
Images '' radio
Images '' radio
Images '' radio Images '' radio
Images '' radio Images '' radio
有人能帮我做这件事吗。请帮忙 我不确定您当前的代码如何尝试执行您想要的操作,但您应该使用。移除所有
顶部
左侧和位置:绝对
,只需使用浮动
、高度
和宽度
。然后使用清除:左代码>到新行
例如,在代码中:
int currLine = 0;
foreach (DataRow item in ds.Tables[0].Rows)
{
if (currLine % 2 == 0)
{
// Every second item, move to a new line
divs += @"<div style=""clear:float;"" />"
}
divs += @" <div style=""float:left; width:400px; margin:10px auto;background:yellow;">
<div style=""width:80px; height:80px;background:red;""
<a href=""#"" class=""screenshot"" rel=""images/"+item["namee"].ToString()+@".jpg"" ><img src=""images/" + item["namee"].ToString() + @".jpg"" width=""80px"" height=""80px"" /></a>
</div>";
if(id < 1){
divs += @" <div style=""width:231px;height: 40px;background:blue;"">
<p style="" margin-top:10px; margin-left:20px; ""><input type=""radio"" name=""SSRI"" value=""" + item["namee"].ToString() + @""" /></p>
</div>";
}
divs += @"<div style=""width:231px; height: 40px;background:green;"">
</div>
</div>";
}
Response.Write(divs);
int currLine=0;
foreach(ds.Tables[0].行中的DataRow项)
{
如果(当前行%2==0)
{
//每隔一秒,移动到新行
divs+=@“”
}
divs+=@”