Click here to Skip to main content
15,886,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

Might be this is very simple question which i am going to ask but i did google for the same but i am not satisfied.
I just want to set table height & width of table. I mean i just want set this table to whole page when i execute.
My code block like:

"<table style='width:100%; font-family:Arial; color:Black; size:10px; text-align:left'>" +
                "<tr><td style='font-weight:bold'>" +
            "Greeting For the Day!!!!,<br/><br/>" +
            "</td></tr>" +

but where i mention height of whole table.
Posted

1 solution

Hi U can set width to table using "100%" but height u can't set using "%",need to use "px".
So ,first use jquery to get windows height or browser height,and pass that height to css code finally use that css in cssclass or class property in table tag.

http://api.jquery.com/height/[^]

http://stackoverflow.com/questions/2407221/how-to-get-the-height-of-the-screen-using-jquery[^]

EX:

In aspx page add this code(code behind)

HTML
.somediv{

height:100%;
}

<script>
$(document).ready(function(){
resizeDiv();
});

window.onresize = function(event) {
resizeDiv();
}

function resizeDiv() {
vpw = $(window).width();
vph = $(window).height();
$(‘#somediv’).css({‘height': vph + ‘px’});
}

</script>
</script>


in table tag u give like this

HTML
<table cssclass="somediv">
  <tr>
   <th>field a</th>
   <th>field b</th>
   <th>field c</th>
   <th>field e</th>
  </tr>
  <tr>
   <td>3534534</td>
   <td>עו"ש</td>
   <td>6,463</td>
   <td>4,000</td>
  </tr>
</table>


Regards
Aravindb
 
Share this answer
 
v2
Comments
Member 11221185 24-Jul-15 7:53am    
Thanks for your valuable time. But this HTML code is used for mail function only.
and when i send mail its look & color with whole body. for this color purpose only i want to set height. means if set height then mail body should look like in color.
Or is any another way to set all mail body with color in HTML??
Aravindba 26-Jul-15 22:02pm    
Hi Only html part appear color,i dont know whole message body fill ur html table.
Member 11221185 27-Jul-15 3:28am    
yes only HTML part fill in color but how i colored whole mail body.
that what i want to do.
Aravindba 27-Jul-15 3:34am    
which email you are using ? outlook or webmail ? u cant give color to whole mail body,What u add mail body with ur html ,that part only appear color,if u need color then u have choose theme from setting if u use gmail account.
Try this link https://litmus.com/blog/background-colors-html-email
Member 11221185 27-Jul-15 8:32am    
Hello i am solve this problem very easily.
I just keep copy image on main server. And now set the background path as url. and my image is shown in mail. finally i solved it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900