Found 2416 Articles for HTML

HTML table with 100% width, with vertical scroll inside tbody

AmitDiwan
Updated on 06-Dec-2022 10:58:10

9K+ Views

We will set the vertical scroll using the overflow-y property − overflow-y: auto; We will hide the horizontal scroll using the overflow-x property − overflow-x: hidden; Example Let us see an example − Display table with vertical scrollbar table.scrolldown { width: 100%; border-spacing: 0; ... Read More

Why doesn't the height of a container element increase if it contains floated elements?

AmitDiwan
Updated on 06-Dec-2022 10:34:58

94 Views

To fix this use, we need to use the overflow property and set it on the outer parent div. We have an inner child div and an outer parent div − The outer parent div is set with the following CSS style. The min-height is set 100px and the overflow property is set to auto. This doesn’t let the height of the container element to increase even if it contains floated elements − .outer { margin: 0 auto; width: 960px; ... Read More

Does ID have to be unique in the whole HTML page?

AmitDiwan
Updated on 06-Dec-2022 10:31:37

127 Views

Yes, IDs must be unique in the entire HTML page. Even the official HTML standards suggest the same − Unique IDs with the id attribute Example Let us see an example. Here, we have used the id attribute − #myHeader { border: 2px solid yellow; background-color: orange; padding: 50px; text-align: ... Read More

How to Clear the Canvas for Redrawing?

AmitDiwan
Updated on 21-Nov-2023 20:56:07

1K+ Views

To clear the canvas for redrawing, use the canvas.clearRect() method in HTML. It clears the specified pixels. The parameters of the method includes − x − The x-coordinate to clear y − The y-coordinate to clear width − The width of the rectangle to clear height − The height of the rectangle to clear Let us see an example to create a canvas and clear it on the click of a button for redrawing in JavaScript. Here’s our canvas code that creates a canvas − var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.strokeRect(5, 5, 25, 15); ctx.scale(2, ... Read More

How to Close Browser Tabs With a Keyboard Shortcut?

AmitDiwan
Updated on 06-Dec-2022 10:32:40

3K+ Views

To close browser tabs, we can surely use Keyboard Shortcuts. Close a Tab on Google Chrome To close a tab on the Chrome web browser, use the following shortcut key on Windows − Ctrl+W To close the entire window on the Chrome web browser, use the following shortcut key on Windows − Ctrl+Shift+W Use the following shortcut key on Mac to close a tab on Chrome − Command+W To close the entire Firefox window on Mac, use the following shortcut − Command+Shift+W Close a Tab on Firefox To close a tab on the Firefox web browser, ... Read More

Create A Form Using HTML Tables?

AmitDiwan
Updated on 06-Dec-2022 10:16:51

8K+ Views

We can easily create a form with tables in HTML. But, before that let us see how to create a form in HTML. Create a Form in HTML Example We will first see how to create a form in HTML using only the tag − HTML Form Details Select the subject you want to choose: Programming Web Development Database Submit Output Create a Form using HTML Tables Example Now, let us convert the above form to a form created using HTML tables − HTML Form Details Select the subject you want to choose: Programming Web Development Database Submit Output

Why doesn't height: 100% work to expand divs to the screen height?

AmitDiwan
Updated on 06-Dec-2022 10:15:28

147 Views

To set the height to 100% for expanding divs to the screen height, set the entire document to − html { height: 100%; } First, we have set both the html and body to − html, body { height: 100%; } The div is set with height and min-height property − #mydiv { min-height: 100% !important; height: 100%; border: 2px solid yellow; width: 200px; background: orange; } Under the , we have our div for which we set the CSS property above − Demo Text Example Let us now see the complete example − Example html, body { height: 100%; } #mydiv { min-height: 100% !important; height: 100%; border: 2px solid yellow; width: 200px; background: orange; } Demo Text Output

How to prevent form from being submitted?

AmitDiwan
Updated on 06-Dec-2022 10:13:52

161 Views

We can easily prevent forms on a web page to submit using the event.preventDefault() or returning Flase on submit event handler. Let us see the example one by one − Prevent form from being submitted using the event.preventDefault() To prevent form from being submitted, use the event.preventDefault() i.e. − Example Let us see the complete example − Details Select the subject you want to choose: ... Read More

jQuery.click() vs onClick

AmitDiwan
Updated on 06-Dec-2022 10:12:36

8K+ Views

In this article, we will learn the difference between the jQuery.click() and onClick. Let us first understand what is click() and onClick() in jQuery. jQuery click() Example The click() method triggers the click event of each matched element. Let us see an example − The jQuery click() Example $(document).ready(function() { ... Read More

Disable browser caching with meta HTML tags

AmitDiwan
Updated on 06-Dec-2022 10:10:43

16K+ Views

To disable browser caching with tag in HTML, use the following code − HTML lets you specify metadata - additional important information about a document in a variety of ways. The META elements can be used to include name/value pairs describing properties of the HTML document, such as author, expiry date, a list of keywords, document author etc. The tag is used to provide such additional information. This tag is an empty element and so does not have a closing tag but it carries information within its attributes. Example Let us see a simple ... Read More

Advertisements