Log in

View Full Version : centre a piece of text within a div



3dkingpin
01-24-2012, 09:41 PM
I know theres no real way of doing this but you have to improvise

so i have numbers 1 to 7 on a new line and want to centre that paragraph within a div. Now i got it to work but there seems to be alot of white space below the number 7 where i have not indicated any text or line breaks etc... so what is this white space that is causing the scroll bar to appear


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="en-UK">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PUBLIC">
<TITLE>New Project</TITLE>
<style type="text/css"> .divScrollAuto {overflow:auto; white-space:nowrap;}</style>
<script type="text/javascript" src="crawler.js"></script>
</HEAD><BODY style="width: 1000px;height: 1000px;background-color: #FFFFFF; ">

<DIV id="newdiv1" title="" align="center" style="border: 1px solid #000000 ;overflow:auto; top: 100; left: 500;

position: absolute; z-index: 101; visibility: show; background-color: transparent; width: 185px; height: 247px; font-size:

20pt; font-family: TIMES NEW ROMAN; color: #000000;"><p style="position: relative;top: -20; padding-top:

10;">1<BR>2<BR>3<BR>4<BR>5<BR>6<BR>7</p></DIV>


</BODY></HTML>

3dkingpin
01-24-2012, 09:45 PM
oh sorry i think i may have sorted it


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="en-UK">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PUBLIC">
<TITLE>New Project</TITLE>
<style type="text/css"> .divScrollAuto {overflow:auto; white-space:nowrap;}</style>
<script type="text/javascript" src="crawler.js"></script>
</HEAD><BODY style="width: 1000px;height: 1000px;background-color: #FFFFFF; ">
<DIV id="newdiv1" title="" align="center" style="border: 1px solid #000000 ;overflow:auto; top: 100; left: 500;

position: absolute; z-index: 101; visibility: show; background-color: transparent; width: 185px; height: 247px; font-size:

20pt; font-family: TIMES NEW ROMAN; color: #000000;"><div style="position: relative;top:

10;">1<BR>2<BR>3<BR>4<BR>5<BR>6<BR>7</div></DIV>
</BODY></HTML>