PDA

View Full Version : Align Text Vertically & div boarder


blimp
06-11-2009, 11:57 PM
I'm finally starting to get the hang of div's and css rules in dreamweaver, but have now hit a new hurdle.

1. What I would like to know is, is it possible to align text vertically without the margin setting? I would like to make my header <p> and footer <p> sit vertically center in that div tag.

2. When I add a boarder to my #contentText_Left css rule, it pushes my footer down a little, how do I fix this?

http://img248.imageshack.us/img248/1033/picture2l.jpg


Code i'm working on:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
* {
margin: 0px;
padding: 0px;
}
#wrapper {
background-color: #D4D4D4;
height: 480px;
width: 640px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
#logo {
background-color: #363;
height: 100px;
}
#wrapper #logo p {
font-family: Tahoma, Geneva, sans-serif;
font-size: 50px;
text-align: center;
color: #999;
vertical-align: middle;
}
#textContent_left {
float: left;
width: 316px;
background-color: #CCC;
height: 300px;
border-right-width: thin;
border-right-style: inset;
border-right-color: #999;
}
#wrapper #textContent_left p {
font-family: Verdana, Geneva, sans-serif;
font-size: 10px;
margin: 20px;
line-height: 16px;
}
#textContent_Right {
background-color: #CCC;
float: right;
height: 300px;
width: 320px;
}
#wrapper #textContent_Right p {
font-family: Verdana, Geneva, sans-serif;
font-size: 10px;
margin: 20px;
line-height: 16px;
}
#wrapper #footer{
font-family: Verdana, Geneva, sans-serif;
font-size: 9px;
height: 80px;
background-color: #CCC;
clear: both;
border-top-width: thin;
border-top-style: dotted;
border-top-color: #666;
}
-->
</style>
</head>

<body>
<div id="wrapper">
<div id="logo">
<p>LOGO or HEADING</p></div>
<div id="textContent_left"><p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p></div>
<div id="textContent_Right"><p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p></div>
<div id="footer"></div>
</div>
</body>
</html>

blimp
06-12-2009, 12:10 AM
I've just worked it out, I deleted the bottom margin on #contentText_Left and adjusted the line-height to fix the spacing.

So what I'd still like to know is about the vertical text alignment?

Anyone.....?

blimp
06-12-2009, 12:18 AM
This is my adjusted code.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
* {
margin: 0px;
padding: 0px;
}
#wrapper {
height: 480px;
width: 640px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
background-color: #CCC;
}
#logo {
background-color: #363;
height: 100px;
}
#wrapper #logo p {
font-family: Tahoma, Geneva, sans-serif;
font-size: 50px;
text-align: center;
color: #999;
vertical-align: middle;
}
#textContent_left {
float: left;
width: 316px;
background-color: #CCC;
height: 300px;
border-right-width: thin;
border-right-style: inset;
border-right-color: #B7B7B7;
}
#wrapper #textContent_left p {
font-family: Verdana, Geneva, sans-serif;
font-size: 10px;
line-height: 15.5px;
margin-top: 20px;
margin-right: 20px;
margin-left: 20px;
}
#textContent_Right {
background-color: #CCC;
float: right;
height: 300px;
width: 320px;
}
#wrapper #textContent_Right p {
font-family: Verdana, Geneva, sans-serif;
font-size: 10px;
margin: 20px;
line-height: 16px;
}
#wrapper #footer{
height: 80px;
clear: both;
border-top-color: #B7B7B7;
border-top-width: 1px;
border-top-style: solid;
}
#wrapper #footer p {
font-family: Verdana, Geneva, sans-serif;
font-size: 9px;
height: 80px;
clear: both;
text-align: center;
color: #999;
}
-->
</style>
</head>

<body>
<div id="wrapper">
<div id="logo">
<p>LOGO or HEADING</p></div>
<div id="textContent_left"><p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p></div>
<div id="textContent_Right"><p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p></div>
<div id="footer"><p>CONTACT INFORMATION</p></div>
</div>
</body>
</html>



and what is should look like when previewed in Safari:


http://img29.imageshack.us/img29/8040/picture3vyj.png