Modifying the height of element HTML

Last update on November 14, 2008 10:34 AM by deri58
Published by deri58

Modifying the height of element HTML






The style property “height” can be used to modify the height of an html element in javascript.


For this you can refer to the following:


Below is an indication of how to do this modification.

If you want to know the height (height) of an HTML block, there are two ways depending on the browsers:

Below are two ways for displaying the height of an HTML block by browsers:
element.offsetHeight
element.style.pixelHeight


Another way to display the height of an HTML block, but this time,regardless of the browsers:

var height = document.getElementById('id_element').style.height;

If you wish to modify this property, you should specify «px». Thus the code for obtaining the height on HTML blog depending on the blog:

<script type="text/javascript">
<!--
var obj = document.getElementById('id_element');
obj.style.height = "502px";
//-->

</script>

If you wish to retrieve the value of the height, you should measure «px » to this value :

<script type="text/javascript">
<!--
var obj = document.getElementById('id_element');
obj.style.height = height+"px";
//-->
</script>
Best answers for « Modifying the height of element HTML » in :
[Javascript]Knowing the height of an HTML element Show [Javascript]Knowing the height of an HTML element To determine the height of a HTML block using JavaScript, independently from the type browsers used, there are two methods: element.offsetHeight...
Defining the relative vertical height of an element ShowDefining the relative vertical height of an element Sometimes we want to define a vertical height of an element. It is simple, using fixed values (not pixels), but it's more complicated when using relative heights (percentage). This...
How to easily display PHP/HTML codes in your webpages ShowHow to easily display PHP/HTML codes in your webpages What code to use? If you want your visitors to be able to see the source codes of your webpage, there is a very easy way to do so. Normally, all you have to do in a HTML file using...
How to make a space in your html document ShowHow to make a space in your html document In HTML there is no way that the web browser can recognise the spaces inserted consecutively in between the letters. You can either try it in EI, Mozilla and Opera. The only way to do so is...
Download Bersoft HTML Print ShowDescription The application is designed by Bersoft Software Groups. HTML Print is a tool that allows you to print HTML pages. Simple and easy to use, the print option allows you to configure the settings of a file. The application allows you to...
Download HTML Ebook Maker and Encrypter ShowAs its name suggests, this software will allow you to encrypt your HTML pages with a password. It supports the following files: HTML, image, flash, swf, video, Javascript and so forth. The encrypted files will be collected in a single .exe file....
Declaring a style sheet (CSS) ShowDeclaring a style sheet Style sheets are not directly integrated into the W3C's HTML recommendations. For this reason, you need to include elements in the HTML code indicating both the type of document, meaning the version of the HTML and CSS...
HTML Markup ShowHTML, A Markup Language HTML is not a programming language. Rather, it is used for describing the layout and format of content, written in the form of simple text. An HTML page is a basic text file containing tags for specifying text format,...
HTML forms ShowForms Interactive forms let web page authors give their pages interactive elements, such as for receiving messages from their readers, much like the reply cards found in some magazines. The reader enters information by filling in fields or clicking...