Kompx.com or Compmiscellanea.com

CSS horizontal and vertical centering - 1

Windows : Internet Explorer 8.0+, Firefox 1.0+, Google Chrome, Opera 4.0+, Safari 3.1+, SeaMonkey 1.0+ [ 1 ].

Linux : Firefox 1.0+, Google Chrome / Chromium, Opera 5.0+, SeaMonkey 1.0+ [ 2 ].

Centering the content of a web page in the viewable area of a browser by means of CSS. A box to contain the whole content of the page is CSS centered horizontally and vertically: [ Open demo page ]


<!DOCTYPE html>



<title>CSS horizontal and vertical centering - 1</title>

<link rel="stylesheet" type="text/css" href="css.css" />



<div class="all">

<div class="wrapper">

<div class="pagecontent">&nbsp;</div>





CSS. Code:

html {height: 100%; margin: 0px;}

body height: 100%; margin: 0px;}

.all {position: relative; left: 0px; top: 0px; height: 100%; width: 100%; float: left; display: table;}

.wrapper {position: relative; left: 0px; top: 0px; height: auto; width: 100%; display: table-cell; vertical-align: middle;}

.pagecontent {position: relative; left: 0px; top: 0px; height: 500px; width: 800px; margin: 0 auto; background: #ff6f6f;}

The .pagecontent box is for the page content. It may be of height assigned explicitly or just "height: auto". Unlike CSS horizontal and vertical centering - 2, here percents may also be used as CSS units; not just px's or em's. Height and width may be larger than web browser viewable area, but here the more practical case is discussed - when the height and width of .pagecontent are smaller than those of the web browser viewable area.

The .pagecontent box is horizontally centered by its "margin: 0 auto".

.All with its CSS properties makes the whole web browser viewable area into a CSS table.

CSS properties makes .wrapper into the cell of this CSS table. The content of this CSS table cell - the .pagecontent box with everything inside it - is vertically centered in the viewable area of a browser by "vertical-align: middle".

[ 1 ]

As well as Netscape 7.2+, Mozilla 1.5+.

[ 2 ]

As well as Netscape 7.2+, Mozilla 1.5+.

Aliosque subditos et thema


Screenshots in DOS


There are several programs for taking screenshots in DOS. SNARF, for instance. Using this application succeeded in taking screenshots in most of the cases. Also, the screenshots' quality (.BMP files) by SNARF results to be the highest among the programs tested: ScreenThief, VideoThief, FLIP, GRABBER, SNARF. Using SNARF with default settings is straightforward, but there is a shortcoming - SNARF always saves screenshots to the folder where the user is currently in. That could be inconvenient or unacceptable. And there is no obvious way to change it. But there is a roundabout option. The initial idea had been found on this page. The result based on it: 1. SNARF [ Download ] 2. Open SNARF.EXE in a text editor in text mode (not hex), find snarf000.bmp and replace it for s:scn000.bin 3. Create a batch file, S.BAT for example, where besides a string for starting SNARF.EXE will be a command assigning the path to the folder screenshots will be saved into to a virtual drive S: The folder and path may be any: C:\SOFT\SNARF.EXE SUBST S: C:\SCREENS\ 4. Start SNARF: S [or S.BAT] 5. To take a screenshot: Alt + S There will be two beeps. The first at the beginning and the second one as a sign the process has completed successfully. After the screenshots are taken, go to the folder where they are saved in and replace the file extensions from .BIN to .BMP SNARF - Freeware.

Renaming files in DOS


Renaming files in DOS by REN command REN FILE1.TXT FILE2.TXT - Renames FILE1.TXT into FILE2.TXT REN FILE1.TXT FILE2.HTM - Renames FILE1.TXT into FILE2.HTM REN *.TXT *.HTM - Renames all files with .txt extension into files with .htm extension. Only extensions are changed, the file names proper are left as they were. Since REN is the shorter form of RENAME command, RENAME may be used instead - as more self-explaining may be. Renaming files in DOS by MOVE command MOVE FILE1.TXT FILE2.TXT - Renames FILE1.TXT into FILE2.TXT MOVE FILE1.TXT FILE2.HTM - Renames FILE1.TXT into FILE2.HTM Both methods of file renaming work in Windows command prompt as well. But there is a certain distinction: MS-DOS, other typical / older DOS'es, command prompt of Windows prior to Windows 95 and Windows NT 3.51 use a short filename / 8.3 filename convention. So, for example, REN FILE1.HTM FILE1.HTML is not going to work, there will be "Duplicate file name or file name not found" message. And that is not the case with newer DOS'es or command prompt of newer Windows. It can be not the case in older DOS'es also - if relevant drivers are installed. [ 1 ] MS-DOS 6.0+ tested - but it also may happen to work well under other versions of MS-DOS or other DOS'es.