asp.net - center content of linkbutton -
I have a link button in a single device; I have height and amp; Width of div to look like a square using CSS I height & amp; Link width through CSS Apart from this, my linkbutto display has been set to block proprioors. (To get the hyperlink effect in full control) I now want the LinkButton text to be centered vertically and horizontally.
I made all possible attributes of div and linkbutton without luck In only one way I could set up this padding (top, left, right), but then it spoils the layout.
.divblock {background-color: #EEEEEE; Border: 2px solid; Width: 90px; Height: 80px; } .Linkbutton {text-decoration: none; color black! Important; Display area; Width: 85px; Height: 80px; }
aspx:
& lt; Div id = "myDiv" runat = "server" & gt; & Lt; ASP: Data List ID = "DL1" Runat = "Server" Repeat Direction = "Horizontal" Item Style- CSS Class = "Items" Item-Style-Horizontal Alliance = "Center" & gt; & Lt; ItemTemplate & gt; ** & lt; Div class = "divblock" & gt; ** & lt; Asp: linkbutton ** cssclass = "linkbutton" ** on command = "prestitsem" id = "testlb1" runat = "server" text = "test" /> & Lt; / Div & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: DataList & gt; & Lt; / Div & gt;
Here's a solution that can work for you:
< P>HTML:
& lt; Div class = "divblock" & gt; & Lt; A href = "" class = "linkbutton" & gt; Home & Lt; / A & gt; & Lt; / Div & gt;
CSS:
.divblock {// display of other styles: table; Text align: center; } .linkbutton {// display of other styles: table-cell; Vertical-row: middle; }
Comments
Post a Comment