Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

div vertical alignment

Posted on 2004-03-30
3
1,016 Views
Last Modified: 2012-06-27
i have a div tag for showing an image everytime i sort desc/asc:


c# assigment

datagridcol.HeaderText = HeaderText.Trim() + "<div ALIGN=right style=top:0;left:0;position:relative;z-index:1; id=" + DataField + "></div>";

======output
<table class="tab" cellspacing="0" cellpadding="4" SortDirection="DESC" border="0" id="DataGrid1" style="border-width:0px;width:100%;border-collapse:collapse;border:solid 1px;">
      <tr class="Grid">
<td align="Center" valign="Middle"><a href="javascript:__doPostBack('DataGrid1$_ctl2$_ctl0','')">Item Code<div ALIGN=right vertical-align:top id=ItemCode></div>

<SCRIPT LANGUAGE=JavaScript1.2>{document.getElementById('ItemCode').innerHTML = '<img src=images/desc_arrow.gif border=0>'}</SCRIPT>

how can i center the image on the div tag?

thanks.
0
Comment
Question by:alain123
  • 2
3 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 250 total points
ID: 10719412
Like this:

<script type"text/javascript">
H=document.getElementById('ItemCode').offsetHeight/2;
str='<span style="position:absolute;top='+H+'px;">';
str+='<img src="images/desc_arrow.gif" border="0"></span>';
document.getElementById('ItemCode').innerHTML =str;
</script>

Cd&
0
 
LVL 1

Author Comment

by:alain123
ID: 10719555
Thank you!
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10719682
Glad I could help. Thanks for the A. :^)

Cd&
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question