Solved

div vertical alignment

Posted on 2004-03-30
3
1,010 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now