vertical align asp panel

cqvnzyubrn

New Member
I have a panel in asp page and I want to add image to this panel so that this image is located at the center of the panel:\[code\]protected void Page_Load(object sender, EventArgs e){ Panel panel = new Panel(); panel.HorizontalAlign = HorizontalAlign.Center; //here I want set verticalAlign for the panel Image image = new Image(); image.imageURL = imageurl; panel.controls.add(image); this.form1.controls.add(panel);}\[/code\]I tried using CSS:\[code\]p.CssClass = "css1";\[/code\]and css is:\[code\]<style type="text/css"> .css1 { vertical-align: middle; }</style>\[/code\]but this didn't give result.So, how to locate image in center of the panel (horizontally and vertically)?Please, do not recommend \[code\]padding-top:20px; \[/code\]this changes the height of the panel. I must keep dimensions of panel constantly.
 
Back
Top