Positioning DIV to the center of Browser Viewport Sometimes I write some JS code to prepare my HTML mockups. In this post I am describing the step-by-step approach on how to position a DIV to the center of browser's viewport. Case Assume that you have a DIV and you want to show it upon clicking a link or button. And that DIV must appear exactly on the center of the browser's window. Technically browser's display area is called "View Port". So our aim is to display a DIV to the center (origin) of the view port. How to do this? 1. Create the DIV. 2. Specify CSS properties 3. Write a few lines of Javascript code to position the DIV 4. Insert an action "onClick" to a button or link in the HTML. Step 1 Write the HTML code for the UI and enclose the code chunk with a DIV. Specify some valid ID for the DIV. For example "AddUserDialog". Step 2 A DIV element, by default will be displayed inline. A dialog box or some other "windowed" UI require...
UPS is a must have accessory for every computers in India. Sudden power failures and surge in supply are common everywhere. To protect valuable data from getting corrupted, it is a must to buy a good UPS. Before we go into the topic, it is essential to understand the types of UPS. What are the types of UPS available? For consumer use, 3 types of UPS - Online, Off-line (stand by) and Line-interactive UPS are available. Online UPS: To explain in simple terms, this UPS supplies AC power to your computer which is converted from the power produced by the battery connected to it. The battery is constantly re-charged by a AC-DC convertor on the other end. Offline UPS: When the mains supply is on, the UPS will pass thru the mains supply to the computer. If mains is cut, it will use a DC-AC convertor and produce power from the attached battery. Line Interactive UPS: Uses a combination of invertor/convertor circuit. When the mains is on, it recharges the battery and produces power ...
Comments