将非文本放在一个表中。

时间:2022-09-02 12:19:01

I am trying to figure out a way to center a "rating" within a table, I can figure out how to align text and images but i can not figure out how to align this rating, since its technically not text or an image.

我正在试图找出一种方法来将“评级”居中在一个表中,我可以找到如何对齐文本和图像,但我无法找到如何对齐这个评级,因为它在技术上不是文本或图像。

the code looks like below

代码如下所示

<td align="center" style="text-align: center; vertical-align: middle; background-color: #444444;" 
    valign="top">
    <cc2:DnnRating ID="ProductReviewAverageOverallRatingDnnRating" 
                    runat="server" ReadOnly="true"
                    Value='<%# Eval("ProductReviewAverageOverallRatingDnnRating_Value") %>' 
                    Visible='<%# Convert.ToBoolean(Eval("ProductReviewAverageOverallRatingDnnRating_Visible")) %>'>
    </cc2:DnnRating>

     ... I would assume that it would go somewhere within the first line. As you can see the text-align is there and vertical-align etc... but it does not work.

…我假设它会在第一行的某个地方。你可以看到文本对齐和垂直对齐等。但它不起作用。

<td align="center" 
    style="text-align: center; vertical-align: middle; background-color: #444444;" 
    valign="top">

I need direction on what to do or how this can be accomplished,

我需要指导去做什么或者如何去做,

Thank You in advance this part if from an inspect

提前谢谢你这部分如果从检查

td valign="top" align="center" style="text-align: center; vertical-align: middle; background-color: #444444;"><div id="dnn_ctr416_ViewRevindexStorefrontProductShowcase_ctl00_ProductShowcaseDnnRotator_i2_ProductReviewAverageOverallRatingDnnRating" class="RadRating RadRating_Default" style="width: 104px; height: 24px;"><ul class="rrtItem"><li class="rrtSelected"></li><li class="rrtSelected"></li><li class="rrtSelected"></li><li class="rrtSelected"><a href="#" title="5"><span></span>

4 个解决方案

#1


2  

Have you tried style="margin:0px auto;"? I can't tell what the rendered HTML would be from the control. Thanks!

你试过风格="边缘:0px auto "吗?我无法从控件中得知呈现的HTML是什么。谢谢!

#2


0  

I assume the list in the comment is the html generated from the cc2:dnnRating control. Lists get rendered with some padding to make room for the bullets. Is this what is messing up your alignment? You can get rid of both bullets and paddings using styles, as described here: W3Schools CSS Navbar

我假设注释中的列表是由cc2:dnnRating控件生成的html。列表用一些填充物呈现,以便为子弹腾出空间。这就是打乱你的队列的原因吗?可以使用样式去掉子弹和挂件,如下所示:W3Schools CSS Navbar

#3


0  

have you tried wrapping it in a SPAN or a DIV and then use 'margin:0px auto;'

你试过用SPAN或DIV来包装它,然后使用“margin:0px auto;”

#4


0  

Try these style changes

试试这些风格变化

Add following css

添加以下css

ul.rrtItem
{
   width:80%;
}

In td add padding-left 19% and padding-right 19%

在td中,左打19%,右打19%

#1


2  

Have you tried style="margin:0px auto;"? I can't tell what the rendered HTML would be from the control. Thanks!

你试过风格="边缘:0px auto "吗?我无法从控件中得知呈现的HTML是什么。谢谢!

#2


0  

I assume the list in the comment is the html generated from the cc2:dnnRating control. Lists get rendered with some padding to make room for the bullets. Is this what is messing up your alignment? You can get rid of both bullets and paddings using styles, as described here: W3Schools CSS Navbar

我假设注释中的列表是由cc2:dnnRating控件生成的html。列表用一些填充物呈现,以便为子弹腾出空间。这就是打乱你的队列的原因吗?可以使用样式去掉子弹和挂件,如下所示:W3Schools CSS Navbar

#3


0  

have you tried wrapping it in a SPAN or a DIV and then use 'margin:0px auto;'

你试过用SPAN或DIV来包装它,然后使用“margin:0px auto;”

#4


0  

Try these style changes

试试这些风格变化

Add following css

添加以下css

ul.rrtItem
{
   width:80%;
}

In td add padding-left 19% and padding-right 19%

在td中,左打19%,右打19%