Forum Moderators: open
I have some HTML code that is working well and is centered in IE6 but the scroll box will not center in Opera or Firefox.
There is a PHP Include there that is working properly and the title text is centered. It is just the scroll box that is not centered.
I am new to coding and was wondering if anyone can see what I may have done wrong?
The code is below.
Thanks a lot,
Bob
--
<!-- RSS Feed Reader Usability In The News -->
<?php unset($arnews);?>
<div class="centerall"><a href="http://www.example1.com/news/user-interface-design-news.html" title="In The News">Usability In The News</a></div>
<div class="centermedium">Latest Headlines
<div class="scroll">
<?php
include
("http://www.example2.com/rss3/rss.php?url=[edited]"
[line break added].$HTTP_SERVER_VARS['SERVER_NAME'].$HTTP_SERVER_VARS['PHP_SELF']."&phpout=1");
?>
</div>
<div class="centermedium"><a href="http://feeds.example3.com/News" title="Usability News Feed"><img src="images/site/rss.gif" alt="Usability In The News RSS Feed"></a></div>
</div>
<!-- /RSS Feed Reader Usability In The News -->
[edited by: tedster at 3:25 am (utc) on July 29, 2005]
body{text-align:center;}
/* centers blocks ie cause ie is silly and won't listen to auto margins */
#centerall{margin:0px auto 0px auto;}
/* this is the proper way to center a block supported by firefox and other compliant browsers*/
Thanks for looking at this. Below are two controlling CSS items. Note that the text within the scroll box is left justified but the box itself is centered as well as the title text.
Keep in mind that I am new to this so the CSS may well be off.
Thanks,
Bob
--
div.scroll {
height: 200px;
width: 147px;
overflow: auto;
text-align: left;
border: 2px solid #999;
background-color: #ccc;
padding: 0 0px 0px 0;
margin: 0px 0px 0px 0px;
float: center;
}
.centerall{
text-align:center;
font-size: 120%;
font-weight: bold;
padding: 0px 0px 0px 0px;
margin: 20px 0px 5px 0px;
}
body{
text-align:center
}
/*to center with css in ie you have to center align text on your
body or like root element*/
div.scroll {
height: 200px;
width: 147px;
overflow: auto;
text-align: left;
border: 2px solid #999;
background-color: #ccc;
padding: 0 0px 0px 0;
margin: 0px auto 0px auto;
}
/* auto margins is the proper way to center a block with css and will work with almost all browsers except ie */
.centerall{
text-align:center;
font-size: 120%;
font-weight: bold;
padding: 0px 0px 0px 0px;
margin: 20px 0px 5px 0px;
}
/* this one should be fine as far as I can tell */
If I'm not mistaken that should do it.
I seem to have one last problem with this code.
I have the two almost identical scroll boxes working fine except for the horizontal scroll bar in the first box. The horizontal bar should not be showing at all but it does in the first box only.
The problem is not with the coding because I can switch boxes and it is always the first box only that is the problem regardless of what is presented in it.
I think it is probably a small </div> error or general formatting error that I am not seeing because I am new to coding. You can assume the PHP and Includes are correct.
You can see the problem at: <SNIP> . My current CSS and HTML are below if that's more convenient.
Can someone see what mistake I am making?
Thanks a lot,
Bob
__
div.scroll {
height: 175px;
width: 145px;
overflow: auto;
text-align: left;
border: 2px solid #999;
background-color: #ccc;
padding: 0 0px 0px 0;
margin: 0px auto 0px auto;
}
.centerall{
text-align:center;
font-size: 120%;
font-weight: bold;
padding: 0px 0px 0px 0px;
margin: 20px auto 5px auto;
float: center;
}
.centermedium{
text-align:center;
font-size: 85%;
font-weight: normal;
padding: 5px 0px 5px 0px
}
__
<!-- RSS Feed Reader Usability In The News -->
<?php unset($arnews);?>
<div class="centerall"><a href="<SNIP>" title="Title">Text</a></div>
<div class="centermedium">Latest Headlines
</div>
<div class="scroll">
<?php
include ("<SNIP>");
?>
</div>
<div class="centermedium"><a href="<SNIP>"><img src="images/site/rss.gif" alt="Text"></a></div>
<!-- /RSS Feed Reader -->
<!-- /RSS Feed Reader -->
<?php unset($arnews);?>
<div class="centerall"><a href="<SNIP>" title="Title">Text</a></div>
<div class="centermedium">Latest Headlines
</div>
<div class="scroll">
<?php
include ("<SNIP>");
?>
</div>
<div class="centermedium"><a href="<SNIP>" title="Title"><img src="images/site/rss.gif" alt="RSS Feed"></a>
</div>
</div>
<!-- /RSS Feed Reader -->
[edited by: BlobFisk at 9:48 am (utc) on Aug. 2, 2005]
[edit reason] No specifics! See TOS [webmasterworld.com] [/edit]
So I apologize if anyone spent much time on the code.
Thanks Everyone,
Bob