Html 表间距问题

Html 表间距问题,html,css,vb.net,html-table,Html,Css,Vb.net,Html Table,我已经建立了一个基于运行的存储过程填充的表。表所在的div的宽度为页面的96%。桌子的宽度是100%。我遇到的问题是,当我有两个三个项目填充表时,这些项目之间有一个巨大的空间。我在表中指定了空间,但这不起作用。我也有问题的字体是黑色的。我删除了所有与”)相关的CSS itmCounter+=1 下一个 ”“接着呢 '确保关闭所有打开的行 如果为ROWISOEN,则为strTable.Append(“”) 如果strTable.Length>0,则 product.InnerHtml=”“&_ s

我已经建立了一个基于运行的存储过程填充的表。表所在的div的宽度为页面的96%。桌子的宽度是100%。我遇到的问题是,当我有两个三个项目填充表时,这些项目之间有一个巨大的空间。我在表中指定了空间,但这不起作用。我也有问题的字体是黑色的。我删除了所有与
”)相关的CSS
itmCounter+=1
下一个
”“接着呢
'确保关闭所有打开的行
如果为ROWISOEN,则为strTable.Append(“”)
如果strTable.Length>0,则
product.InnerHtml=”“&_
strTable.ToString()和_
""
如果结束

表格在HTML中具有特定的角色,但在这种情况下,您可能需要使用div。div将根据浏览器的宽度自动浮动和重新定位

下面是一个例子

HTML

您的代码可能如下所示

Dim con5 As New SqlConnection
Dim cmd5 As New SqlCommand
Dim index As Integer = 0
Dim dt1 As New DataSet

con5.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
con5.Open()
cmd5.Connection = con5
cmd5.CommandType = CommandType.StoredProcedure
cmd5.CommandText = "ProductBreakdown"
cmd5.Parameters.Add(New SqlParameter("ProductID", SqlDbType.Int)).Value = Session("Product")
cmd5.Parameters.Add(New SqlParameter("DesignName", SqlDbType.VarChar, 50)).Value = Request.QueryString("o")


Dim da1 As SqlDataAdapter = New SqlDataAdapter(cmd5)
da1.Fill(dt1)

dv = New DataView(dt1.Tables(0))

Dim strTable As New StringBuilder()
Dim itmCounter As Integer = 0
strTable.Append("<div class=""table""> ")

For Each dr As DataRowView In dv

    Dim crossover As String = dr("CrossoverID").ToString()
    Dim picid As String = dr("Description").ToString()
    Dim picdescrip As String = dr("DesignColor").ToString().ToUpper()
    Dim collectionname As String = dr("CollectionDescription").ToString().ToUpper()
    Dim designinfo As String = dr("DesignName").ToString()
    Session("Collection") = dr("CollectionDescription").ToString()

    strTable.Append("<div class=""cell""><a href=""Sheet Vinyl Tile Product Page.aspx?p=" & crossover & "&o=" & designinfo & """>")
    strTable.Append("<img src=""Images/Products/" + picid + ".jpg""width=""188"" height=""188"" border=""0"""" /><br/><br/>")
    strTable.Append("<b><color=Black>" & collectionname & "</b><br />")
    strTable.Append(picdescrip & "</a></div>")

    itmCounter += 1

Next
strTable.Append("</div>")
product.InnerHtml = strTable.ToString()
Dim con5作为新的SqlConnection
Dim cmd5作为新的SqlCommand
作为整数的Dim索引=0
Dim dt1作为新数据集
con5.ConnectionString=ConfigurationSettings.AppSettings(“ConnectionString”)
con5.Open()
cmd5.连接=con5
cmd5.CommandType=CommandType.StoredProcess
cmd5.CommandText=“ProductBreakdown”
cmd5.Parameters.Add(新的SqlParameter(“ProductID”,SqlDbType.Int)).Value=Session(“产品”)
cmd5.Parameters.Add(新的SqlParameter(“DesignName”,SqlDbType.VarChar,50)).Value=Request.QueryString(“o”)
Dim da1作为SqlDataAdapter=新的SqlDataAdapter(cmd5)
da1.填充(dt1)
dv=新数据视图(dt1.表(0))
作为新StringBuilder()的Dim标准表
Dim ITM计数器为整数=0
strTable.Append(“”)
对于dv中的每个dr作为DataRowView
作为字符串的Dim crossover=dr(“CrossoverID”).ToString()
Dim picid As String=dr(“Description”).ToString()
Dim PICDESRIP As String=dr(“设计颜色”).ToString().ToUpper()
Dim collectionname As String=dr(“CollectionDescription”).ToString().ToUpper()
Dim designinfo As String=dr(“设计名称”).ToString()
Session(“Collection”)=dr(“CollectionDescription”).ToString()
strTable.Append(“”)
itmCounter+=1
下一个
strTable.Append(“”)
product.InnerHtml=strTable.ToString()

字体颜色同样美味,但热量更少

,采用HTML制作:“&collectionname&”
(从90年代开始:))如果执行此操作,您将如何运行存储过程?您是以相同的方式还是类似的方式运行?存储过程只是提取数据。您要关注的区域是呈现,即strTable.Append()。使用我提供的CSS:使
<div class="table">
    <div class="banner">The preferred developer response</div>
    <div class="cell">
        <img src="happy-icon.png">
    </div>
    ... 
    <div class="banner">Other emotions</div>
    <div class="cell">
        <img src="sad-icon.png">
    </div>
...
</div>
.table {
    margin-left: 50px;
    margin-right: 50px;
}
.banner {
    padding: 10px;
    margin-top: 20px;
    clear: both;
    background-color: #336699;
    color: white;
    font-weight: bold;
}
.cell {
    width:   150px;
    float: left;
}
Dim con5 As New SqlConnection
Dim cmd5 As New SqlCommand
Dim index As Integer = 0
Dim dt1 As New DataSet

con5.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
con5.Open()
cmd5.Connection = con5
cmd5.CommandType = CommandType.StoredProcedure
cmd5.CommandText = "ProductBreakdown"
cmd5.Parameters.Add(New SqlParameter("ProductID", SqlDbType.Int)).Value = Session("Product")
cmd5.Parameters.Add(New SqlParameter("DesignName", SqlDbType.VarChar, 50)).Value = Request.QueryString("o")


Dim da1 As SqlDataAdapter = New SqlDataAdapter(cmd5)
da1.Fill(dt1)

dv = New DataView(dt1.Tables(0))

Dim strTable As New StringBuilder()
Dim itmCounter As Integer = 0
strTable.Append("<div class=""table""> ")

For Each dr As DataRowView In dv

    Dim crossover As String = dr("CrossoverID").ToString()
    Dim picid As String = dr("Description").ToString()
    Dim picdescrip As String = dr("DesignColor").ToString().ToUpper()
    Dim collectionname As String = dr("CollectionDescription").ToString().ToUpper()
    Dim designinfo As String = dr("DesignName").ToString()
    Session("Collection") = dr("CollectionDescription").ToString()

    strTable.Append("<div class=""cell""><a href=""Sheet Vinyl Tile Product Page.aspx?p=" & crossover & "&o=" & designinfo & """>")
    strTable.Append("<img src=""Images/Products/" + picid + ".jpg""width=""188"" height=""188"" border=""0"""" /><br/><br/>")
    strTable.Append("<b><color=Black>" & collectionname & "</b><br />")
    strTable.Append(picdescrip & "</a></div>")

    itmCounter += 1

Next
strTable.Append("</div>")
product.InnerHtml = strTable.ToString()