문제

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>
도움이 되었습니까?

해결책

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

다른 팁

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

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

Try these style changes

Add following css

ul.rrtItem
{
   width:80%;
}

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top