...

View Full Version : Formatting Text With Background Color



andynov123
07-03-2011, 04:40 AM
Hi
I'm having problems with the more button in the code below. When you zoom out of the page the more button's left and right sides expand as the page zooms out. How do I make the sides stay put so its more like a button and not weird looking?



<!DOCTYPE HTML>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title></title>

<style type="text/css">

*{margin:0px; padding:0px;}


.rank {
font-size:45px;
color: #FFFFFF;

height:6%;

border-top:#000;
}


#wrapper{width:100%; margin:0px auto; background-color: #3d3d3d;}

#top { border-bottom: 1px solid #000;}
#header {
width: 100%;
height: 75px;
border: 1px solid #000000;
background-color: #000;
float:left;
color: #FFFFFF;
}
#col1{width:20%;
height:430px;
float:left;

}
#col2{width:40%;
height:430px;
float:left;
background-image:url('metal.jpg');
}
#col3{width:20%;
height:430px;

float:left;


}
#footer{width:100%;
height:100%;
clear:both;
overflow:hidden;
background-color: #000;
text-align: center;
padding-top:70px;
color: #FFFFFF;}
body{overflow-x:hidden;
overflow-y:auto;
background-color: #000;}
.buffer{
background:gray;
width:10%;
height:430px;
float:left;
}
.hhr{
display:block;
visibility:hidden;
}
#img {text-align:center;}
.col_cont{
background-image:url('metal.jpg');
border:1px solid black;
height:100%;


}
#ma{position:relative;bottom:60px;color:white;font-size:35px;font-weight:bold;}
#ratetype {font-size:35px;margin-top:10px;margin-top:-20px;position:relative;top:26px;}
#pal {position:relative;top:70px;border-bottom:solid;border-color:black;}
#col2content {text-align:center;overfloFw-x:hidden;color:white; width:99%;background-color: #00a3e8;
overflow-y:auto;height:99%; border-style:solid;border-color:black;}
.col_cont ol{
background-image:url('metal.jpg');

height:100%;
padding-left:30px;
}
#links p {border-bottom:solid;margin-top:-7px;padding-bottom:53px;font-size:28px;}
#links {font-size:28px;text-align:center;padding-top:12px;padding-bottom:8px;border-bottom:solid; margin-top:4px;}
.top{
text-align:center;font-size:25px;font-weight:bold;padding-top:10px;
}
#share {padding-top:8Px;margin-top:-38px;font-size:28px;}
.more {text-align:center;font-size:25px;padding-top:0px;margin-top:305px;width:60%; margin-left:53px;background-color: #00a3e8;border-style:solid;}
#all{margin-top:-50px;font-size:25px;text-align:center;}
A:link {text-decoration: none}
A:visited {text-decoration: none;color:black;}
A:active {text-decoration: none}
A:hover {text-decoration: none; color: white;}
# {text-align:center;position:relative;bottom:180px;font-size:22px;
}
#mininavi
{text-decoration: none; float:right;color:white;position:relative;top:35px;left:90px; }
#mininavi a:link {text-decoration: none; color:white; }
#mininavi a:visited {text-decoration: none; color:white; }
#mininavi1 a:link {text-decoration: none; color:white; }
#mininavi1 a:visited {text-decoration: none; color:white; }
#mininavi1 a:hover {text-decoration: none; color:#00a3e8; }
#mininavi a:hover {text-decoration: none; color:#00a3e8; }

#mininavi1 {float:right;color:white;position:relative;top:35px;left:210px;}
#pal {position:relative;top:70px;border-bottom:solid;border-color:black;}
#like {padding-top:35px;}
#like p {font-size:20px;}
#rtj {position:relative;bottom:73px;font-size:30px;color:white;border-bottom:solid;border-color:black;}
#browsetext{text-align:center;border-style:none;}
#browsebutton {text-align:center;font-size:17px;color:white;}
#submitbutton{font-size:25px;position:relative;top:55px;border-bottom:solid;border-color:black;padding-bottom:3px;margin-top:-45px;}
div.rank{
font-size:25px;
position:relative;bottom:10px;
padding-left:15px;


color: #000;
}
#myuploaded{position:relative;top:235px;font-size:25px;font-weight:bold;}
#welcome{color:white;float:right;padding-right:140px;padding-top:15px;}
#gre {text-align:center;position:relative;top:9px;right:4px;color:white;}
#sj{position:relative;text-align:center;color:white;top:-20px;font-size:30px;font-weight:bold;}
#rating {text-align:center;position:relative;bottom:180px;font-size:22px;
}

#col1white {font-weight:bold;background-color:white; color: #00a3e8;position:relative;bottom:288px;height:64%;border-style:solid;border-color:black;font-size:30px;text-align:center;padding-top:10px;}
ul {
text-decoration: underline;
list-style-type: none;text-align:center;padding-top:20px;font-size:25px;
}
#outnow {font-size:28px;text-align:center;padding-bottom:-28px;margin-top:54px;padding-top:-2px;}
#navi1 {text-align:center;}
div.rank ol li{
font-size:20px;



color: #000;

}
#title {text-align:center;color:white;padding-top:5px;}
#profile {padding-bottom:0px;margin-top:-90px;font-size:28px;position:relative;top:49px;}
#rank1{font-size:30px;}
</style>
</head>
<body>
<div id="wrapper">
<div id="header"><div id="welcome">Welcome</div><div id="mininavi"><a href="">Settings</a></div>
<div id="mininavi1"><a href="">Log Out</a></div></div>

<div id="col1"><div id="img"></div>
<div class="col_cont">
<div id="links">
<p><a href="mb.html">Link 1</a></p>



<div id="profile"> <a href="s.html">Link 2</a></div>
</div><div id="outnow"><a href="index.html">Link 3</a></div><div id="navi1"></div><hr class="hhr"/></div><div id="col1white"><div id="like">



</div>
</div>
</div>

<div class="buffer"><hr class="hhr"/></div>

<div id="col2">
<div id="col2content"> <div id="myuploaded">My Uploaded</div><div id="sj">S
</div>
<form>
<div id="browsebutton">Upload <br />
<input type="file" name="uploadFile">
<input type="hidden" name="MAX_FILE_SIZE" value="15000" />


<div id="title">title<br/> <input type="text" name="browse" /></div></div><div id="gre">gre<br />


</div><div id="submitbutton"><input type="submit" value="Submit" /></div></form>
</div>

</div>

<div class="buffer"><hr class="hhr"/></div>

<div id="col3"> <div class="col_cont"> <div class="top">
Top </div>
<div class="rank">
<ul><li></li>
<li></li>
<li></li>
<li><a href=""><span>1.</span>This is line 1</a></li>
<li><a href=""><span>2.</span>This is line 2</a></li>
<li><a href=""><span>3.</span>This is line 3</a></li>
<li><a href=""><span>4.</span>This is line 4</a></li>
<li><a href=""><span>5.</span>This is line 5</a></li>
<li><a href=""><span>6.</span>This is line 6</a></li>
<li><a href=""><span>7.</span>This is line 7</a></li>
<li><a href=""><span>8.</span>This is line 8</a></li>
<li><a href=""><span>9.</span>This is line 9</a></li>
<li><a href=""><span>10.</span>This is line 10</a></li>


</ul>
</div>
<a href=""><div class="more">More</div></a>




<hr class="hhr"/>

</div>
</div>
<div id="footer">


<p>Contact Us</p>
</div>
</body>
</html>

Sammy12
07-03-2011, 05:37 AM
The left and right will expand indefinetly, because when you zoom, you are increasing the % of the screen.

andynov123
07-03-2011, 05:52 AM
I added it to my css but it messed up the list on the right. so I added it to .more like this
What am I doing wrong?


<!DOCTYPE HTML>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title></title>

<style type="text/css">

*{margin:0px; padding:0px;}


.rank {
font-size:45px;
color: #FFFFFF;

height:6%;

border-top:#000;
}


#wrapper{width:100%; margin:0px auto; background-color: #3d3d3d;}

#top { border-bottom: 1px solid #000;}
#header {
width: 100%;
height: 75px;
border: 1px solid #000000;
background-color: #000;
float:left;
color: #FFFFFF;
}
.more ul {
height: 200px;
overflow: hidden;
width: 100px;
}

.more ul li {
height: 43px;
overflow: hidden;
}
#col1{width:20%;
height:430px;
float:left;

}
#col2{width:40%;
height:430px;
float:left;
background-image:url('metal.jpg');
}
#col3{width:20%;
height:430px;

float:left;


}
#footer{width:100%;
height:100%;
clear:both;
overflow:hidden;
background-color: #000;
text-align: center;
padding-top:70px;
color: #FFFFFF;}
body{overflow-x:hidden;
overflow-y:auto;
background-color: #000;}
.buffer{
background:gray;
width:10%;
height:430px;
float:left;
}
.hhr{
display:block;
visibility:hidden;
}
#img {text-align:center;}
.col_cont{
background-image:url('metal.jpg');
border:1px solid black;
height:100%;


}
#ma{position:relative;bottom:60px;color:white;font-size:35px;font-weight:bold;}
#ratetype {font-size:35px;margin-top:10px;margin-top:-20px;position:relative;top:26px;}
#pal {position:relative;top:70px;border-bottom:solid;border-color:black;}
#col2content {text-align:center;overfloFw-x:hidden;color:white; width:99%;background-color: #00a3e8;
overflow-y:auto;height:99%; border-style:solid;border-color:black;}
.col_cont ol{
background-image:url('metal.jpg');

height:100%;
padding-left:30px;
}
#links p {border-bottom:solid;margin-top:-7px;padding-bottom:53px;font-size:28px;}
#links {font-size:28px;text-align:center;padding-top:12px;padding-bottom:8px;border-bottom:solid; margin-top:4px;}
.top{
text-align:center;font-size:25px;font-weight:bold;padding-top:10px;
}
#share {padding-top:8Px;margin-top:-38px;font-size:28px;}
.more {text-align:center;font-size:25px;padding-top:0px;margin-top:305px;width:60%; margin-left:53px;background-color: #00a3e8;border-style:solid;}
#all{margin-top:-50px;font-size:25px;text-align:center;}
A:link {text-decoration: none}
A:visited {text-decoration: none;color:black;}
A:active {text-decoration: none}
A:hover {text-decoration: none; color: white;}
# {text-align:center;position:relative;bottom:180px;font-size:22px;
}
#mininavi
{text-decoration: none; float:right;color:white;position:relative;top:35px;left:90px; }
#mininavi a:link {text-decoration: none; color:white; }
#mininavi a:visited {text-decoration: none; color:white; }
#mininavi1 a:link {text-decoration: none; color:white; }
#mininavi1 a:visited {text-decoration: none; color:white; }
#mininavi1 a:hover {text-decoration: none; color:#00a3e8; }
#mininavi a:hover {text-decoration: none; color:#00a3e8; }

#mininavi1 {float:right;color:white;position:relative;top:35px;left:210px;}
#pal {position:relative;top:70px;border-bottom:solid;border-color:black;}
#like {padding-top:35px;}
#like p {font-size:20px;}
#rtj {position:relative;bottom:73px;font-size:30px;color:white;border-bottom:solid;border-color:black;}
#browsetext{text-align:center;border-style:none;}
#browsebutton {text-align:center;font-size:17px;color:white;}
#submitbutton{font-size:25px;position:relative;top:55px;border-bottom:solid;border-color:black;padding-bottom:3px;margin-top:-45px;}
div.rank{
font-size:25px;
position:relative;bottom:10px;
padding-left:15px;


color: #000;
}
#myuploaded{position:relative;top:235px;font-size:25px;font-weight:bold;}
#welcome{color:white;float:right;padding-right:140px;padding-top:15px;}
#gre {text-align:center;position:relative;top:9px;right:4px;color:white;}
#sj{position:relative;text-align:center;color:white;top:-20px;font-size:30px;font-weight:bold;}
#rating {text-align:center;position:relative;bottom:180px;font-size:22px;
}

#col1white {font-weight:bold;background-color:white; color: #00a3e8;position:relative;bottom:288px;height:64%;border-style:solid;border-color:black;font-size:30px;text-align:center;padding-top:10px;}
ul {
text-decoration: underline;
list-style-type: none;text-align:center;padding-top:20px;font-size:25px;
}
#outnow {font-size:28px;text-align:center;padding-bottom:-28px;margin-top:54px;padding-top:-2px;}
#navi1 {text-align:center;}
div.rank ol li{
font-size:20px;



color: #000;

}
#title {text-align:center;color:white;padding-top:5px;}
#profile {padding-bottom:0px;margin-top:-90px;font-size:28px;position:relative;top:49px;}
#rank1{font-size:30px;}
</style>
</head>
<body>
<div id="wrapper">
<div id="header"><div id="welcome">Welcome</div><div id="mininavi"><a href="">Settings</a></div>
<div id="mininavi1"><a href="">Log Out</a></div></div>

<div id="col1"><div id="img"></div>
<div class="col_cont">
<div id="links">
<p><a href="mb.html">Link 1</a></p>



<div id="profile"> <a href="s.html">Link 2</a></div>
</div><div id="outnow"><a href="index.html">Link 3</a></div><div id="navi1"></div><hr class="hhr"/></div><div id="col1white"><div id="like">



</div>
</div>
</div>

<div class="buffer"><hr class="hhr"/></div>

<div id="col2">
<div id="col2content"> <div id="myuploaded">My Uploaded</div><div id="sj">S
</div>
<form>
<div id="browsebutton">Upload <br />
<input type="file" name="uploadFile">
<input type="hidden" name="MAX_FILE_SIZE" value="15000" />


<div id="title">title<br/> <input type="text" name="browse" /></div></div><div id="gre">gre<br />


</div><div id="submitbutton"><input type="submit" value="Submit" /></div></form>
</div>

</div>

<div class="buffer"><hr class="hhr"/></div>

<div id="col3"> <div class="col_cont"> <div class="top">
Top </div>
<div class="rank">
<ul><li></li>
<li></li>
<li></li>
<li><a href=""><span>1.</span>This is line 1</a></li>
<li><a href=""><span>2.</span>This is line 2</a></li>
<li><a href=""><span>3.</span>This is line 3</a></li>
<li><a href=""><span>4.</span>This is line 4</a></li>
<li><a href=""><span>5.</span>This is line 5</a></li>
<li><a href=""><span>6.</span>This is line 6</a></li>
<li><a href=""><span>7.</span>This is line 7</a></li>
<li><a href=""><span>8.</span>This is line 8</a></li>
<li><a href=""><span>9.</span>This is line 9</a></li>
<li><a href=""><span>10.</span>This is line 10</a></li>


</ul>
</div>
<a href=""><div class="more">More</div></a>




<hr class="hhr"/>

</div>
</div>
<div id="footer">


<p>Contact Us</p>
</div>
</body>
</html>

Sammy12
07-03-2011, 06:01 AM
That would set the "more" tag to have a height of 200px!

Sammy12
07-03-2011, 06:07 AM
.rank { height: 200px; overflow: hidden; }
ul { height: 200px; overflow: hidden; }


delete JUST margin-top and margin-left and replace with:


.more { margin-top: 0; margin: auto; }

andynov123
07-03-2011, 06:16 AM
I gotrid of margin-top and margin-left still have problems though. Is this something to do with 200px. If so what would be a proper setting?



<!DOCTYPE HTML>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title></title>

<style type="text/css">

*{margin:0px; padding:0px;}


.rank {
font-size:45px;
color: #FFFFFF;

height:6%;

border-top:#000;
}


#wrapper{width:100%; margin:0px auto; background-color: #3d3d3d;}

#top { border-bottom: 1px solid #000;}
#header {
width: 100%;
height: 75px;
border: 1px solid #000000;
background-color: #000;
float:left;
color: #FFFFFF;
}
.more ul {
height: 200px;
overflow: hidden;
width: 100px;
}

.more ul li {
height: 43px;
overflow: hidden;
}
#col1{width:20%;
height:430px;
float:left;

}
#col2{width:40%;
height:430px;
float:left;
background-image:url('metal.jpg');
}
#col3{width:20%;
height:430px;

float:left;


}
#footer{width:100%;
height:100%;
clear:both;
overflow:hidden;
background-color: #000;
text-align: center;
padding-top:70px;
color: #FFFFFF;}
body{overflow-x:hidden;
overflow-y:auto;
background-color: #000;}
.buffer{
background:gray;
width:10%;
height:430px;
float:left;
}
.hhr{
display:block;
visibility:hidden;
}
#img {text-align:center;}
.col_cont{
background-image:url('metal.jpg');
border:1px solid black;
height:100%;


}
#ma{position:relative;bottom:60px;color:white;font-size:35px;font-weight:bold;}
#ratetype {font-size:35px;margin-top:10px;margin-top:-20px;position:relative;top:26px;}
#pal {position:relative;top:70px;border-bottom:solid;border-color:black;}
#col2content {text-align:center;overfloFw-x:hidden;color:white; width:99%;background-color: #00a3e8;
overflow-y:auto;height:99%; border-style:solid;border-color:black;}
.col_cont ol{
background-image:url('metal.jpg');

height:100%;
padding-left:30px;
}
#links p {border-bottom:solid;margin-top:-7px;padding-bottom:53px;font-size:28px;}
#links {font-size:28px;text-align:center;padding-top:12px;padding-bottom:8px;border-bottom:solid; margin-top:4px;}
.top{
text-align:center;font-size:25px;font-weight:bold;padding-top:10px;
}

#share {padding-top:8Px;margin-top:-38px;font-size:28px;}
.more {text-align:center;font-size:25px;padding-top:0px;width:60%; margin-top: 0; margin: auto; background-color: #00a3e8;border-style:solid;}
#all{margin-top:-50px;font-size:25px;text-align:center;}
A:link {text-decoration: none}
A:visited {text-decoration: none;color:black;}
A:active {text-decoration: none}
A:hover {text-decoration: none; color: white;}
# {text-align:center;position:relative;bottom:180px;font-size:22px;
}
#mininavi
{text-decoration: none; float:right;color:white;position:relative;top:35px;left:90px; }
#mininavi a:link {text-decoration: none; color:white; }
#mininavi a:visited {text-decoration: none; color:white; }
#mininavi1 a:link {text-decoration: none; color:white; }
#mininavi1 a:visited {text-decoration: none; color:white; }
#mininavi1 a:hover {text-decoration: none; color:#00a3e8; }
#mininavi a:hover {text-decoration: none; color:#00a3e8; }

#mininavi1 {float:right;color:white;position:relative;top:35px;left:210px;}
#pal {position:relative;top:70px;border-bottom:solid;border-color:black;}
#like {padding-top:35px;}
#like p {font-size:20px;}
#rtj {position:relative;bottom:73px;font-size:30px;color:white;border-bottom:solid;border-color:black;}
#browsetext{text-align:center;border-style:none;}
#browsebutton {text-align:center;font-size:17px;color:white;}
#submitbutton{font-size:25px;position:relative;top:55px;border-bottom:solid;border-color:black;padding-bottom:3px;margin-top:-45px;}
div.rank{
font-size:25px;
position:relative;bottom:10px;
padding-left:15px;


color: #000;
}
#myuploaded{position:relative;top:235px;font-size:25px;font-weight:bold;}
#welcome{color:white;float:right;padding-right:140px;padding-top:15px;}
#gre {text-align:center;position:relative;top:9px;right:4px;color:white;}
#sj{position:relative;text-align:center;color:white;top:-20px;font-size:30px;font-weight:bold;}
#rating {text-align:center;position:relative;bottom:180px;font-size:22px;
}

#col1white {font-weight:bold;background-color:white; color: #00a3e8;position:relative;bottom:288px;height:64%;border-style:solid;border-color:black;font-size:30px;text-align:center;padding-top:10px;}
ul {
text-decoration: underline;
list-style-type: none;text-align:center;padding-top:20px;font-size:25px;
}
#outnow {font-size:28px;text-align:center;padding-bottom:-28px;margin-top:54px;padding-top:-2px;}
#navi1 {text-align:center;}
div.rank ol li{
font-size:20px;



color: #000;

}
#title {text-align:center;color:white;padding-top:5px;}
#profile {padding-bottom:0px;margin-top:-90px;font-size:28px;position:relative;top:49px;}
#rank1{font-size:30px;}
</style>
</head>
<body>
<div id="wrapper">
<div id="header"><div id="welcome">Welcome</div><div id="mininavi"><a href="">Settings</a></div>
<div id="mininavi1"><a href="">Log Out</a></div></div>

<div id="col1"><div id="img"></div>
<div class="col_cont">
<div id="links">
<p><a href="mb.html">Link 1</a></p>



<div id="profile"> <a href="s.html">Link 2</a></div>
</div><div id="outnow"><a href="index.html">Link 3</a></div><div id="navi1"></div><hr class="hhr"/></div><div id="col1white"><div id="like">



</div>
</div>
</div>

<div class="buffer"><hr class="hhr"/></div>

<div id="col2">
<div id="col2content"> <div id="myuploaded">My Uploaded</div><div id="sj">S
</div>
<form>
<div id="browsebutton">Upload <br />
<input type="file" name="uploadFile">
<input type="hidden" name="MAX_FILE_SIZE" value="15000" />


<div id="title">title<br/> <input type="text" name="browse" /></div></div><div id="gre">gre<br />


</div><div id="submitbutton"><input type="submit" value="Submit" /></div></form>
</div>

</div>

<div class="buffer"><hr class="hhr"/></div>

<div id="col3"> <div class="col_cont"> <div class="top">
Top </div>
<div class="rank">
<ul><li></li>
<li></li>
<li></li>
<li><a href=""><span>1.</span>This is line 1</a></li>
<li><a href=""><span>2.</span>This is line 2</a></li>
<li><a href=""><span>3.</span>This is line 3</a></li>
<li><a href=""><span>4.</span>This is line 4</a></li>
<li><a href=""><span>5.</span>This is line 5</a></li>
<li><a href=""><span>6.</span>This is line 6</a></li>
<li><a href=""><span>7.</span>This is line 7</a></li>
<li><a href=""><span>8.</span>This is line 8</a></li>
<li><a href=""><span>9.</span>This is line 9</a></li>
<li><a href=""><span>10.</span>This is line 10</a></li>


</ul>
</div>
<a href=""><div class="more">More</div></a>




<hr class="hhr"/>

</div>
</div>
<div id="footer">


<p>Contact Us</p>
</div>
</body>
</html>

Sammy12
07-03-2011, 06:21 AM
http://i1114.photobucket.com/albums/k535/auroralight1/Untitled-2.png

What appears to be the problem?

andynov123
07-03-2011, 06:25 AM
If you zoom out the more button's background color expands left and right. I feel it looks unprofessional and thats what I want to fix. I want the background color not to move at all when zooming out of page.

Sammy12
07-03-2011, 07:09 AM
I would say that isn't possible to stop it from growing. You are increasing the width and height of the more button from 100% --> 130%, in effect the width and height must increase, like the rest of the page. What if a user is on a large screen than you? What about smaller? It will decrease % wise.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum