nostalgia75
01-08-2008, 09:24 PM
Greetings, all. I'm trying to make a 'go back' link at the top of my web page. I'd like it to appear to the left of the centered title text on the page but on the same line vertically. For example:
< Go Back WIDGET PAGE
I'm very close, but with the following code "WIDGET PAGE" gets centered between the right of "< Go Back" and the right edge of the page, instead of being centered in the whole page as I'd like.
CSS:
.mainpage ul#headernav
{
list-style-type: none;
padding: 0 0;
border: none thin;
height: 22px;
font-size: 8pt;
text-align: center;
}
.mainpage ul#headernav li
{
display: block;
width: auto;
padding: 2px;
text-align: center;
}
.mainpage ul#headernav .left { float: left; }
HTML:
<ul id="headernav">
<li class='left'><a ref="#"< Go Back</a></li>
<li class='center'>WIDGET PAGE</li>
</ul>
I've tried various experiments with the 'center' class with no luck. I've also tried various iterations of moving the WIDGET PAGE HTML out of the <ul>, notably something like:
CSS:
.mainpage #header
{
text-align: center;
}
.mainpage ul#headernav
{
list-style-type: none;
padding: 0 0;
border: none thin;
height: 22px;
font-size: 8pt;
text-align: center;
width: 10%;
float: left;
}
.mainpage ul#headernav li
{
display: block;
width: auto;
padding: 2px;
text-align: center;
border: none thin;
}
.mainpage ul#headernav .left { float: left; }
HTML:
<div id="header">
<ul id="headernav">
<li class='left'><a href="#">< Go Back</a></li>
</ul>
<p class='center'>WIDGET PAGE</p>
</div>
Which results in odd behavior where the "Go Back" block is lower than the WIDGET PAGE text and interferes with the table immediately following WIDGET PAGE - the table is aligned to the right edge of the "Go Back" block. Like this:
WIDGET PAGE
< Go Back
|-----------------------------------------------------|
| Awesome ASCII art table |
If I add a "border: solid thin;" to .mainpage #header, the <ul> and <p> blocks align vertically and there is no longer any interference with the table. I didn't realize alignment was dependent on whether or not a block's border was visible.
-------------------------------------------------------
|< Go Back WIDGET PAGE |
-------------------------------------------------------
|-----------------------------------------------------|
| Awesome ASCII art table |
Thanks for any advice. I'm just learning CSS and having fun, but this is making me a little batty.
-Joe
< Go Back WIDGET PAGE
I'm very close, but with the following code "WIDGET PAGE" gets centered between the right of "< Go Back" and the right edge of the page, instead of being centered in the whole page as I'd like.
CSS:
.mainpage ul#headernav
{
list-style-type: none;
padding: 0 0;
border: none thin;
height: 22px;
font-size: 8pt;
text-align: center;
}
.mainpage ul#headernav li
{
display: block;
width: auto;
padding: 2px;
text-align: center;
}
.mainpage ul#headernav .left { float: left; }
HTML:
<ul id="headernav">
<li class='left'><a ref="#"< Go Back</a></li>
<li class='center'>WIDGET PAGE</li>
</ul>
I've tried various experiments with the 'center' class with no luck. I've also tried various iterations of moving the WIDGET PAGE HTML out of the <ul>, notably something like:
CSS:
.mainpage #header
{
text-align: center;
}
.mainpage ul#headernav
{
list-style-type: none;
padding: 0 0;
border: none thin;
height: 22px;
font-size: 8pt;
text-align: center;
width: 10%;
float: left;
}
.mainpage ul#headernav li
{
display: block;
width: auto;
padding: 2px;
text-align: center;
border: none thin;
}
.mainpage ul#headernav .left { float: left; }
HTML:
<div id="header">
<ul id="headernav">
<li class='left'><a href="#">< Go Back</a></li>
</ul>
<p class='center'>WIDGET PAGE</p>
</div>
Which results in odd behavior where the "Go Back" block is lower than the WIDGET PAGE text and interferes with the table immediately following WIDGET PAGE - the table is aligned to the right edge of the "Go Back" block. Like this:
WIDGET PAGE
< Go Back
|-----------------------------------------------------|
| Awesome ASCII art table |
If I add a "border: solid thin;" to .mainpage #header, the <ul> and <p> blocks align vertically and there is no longer any interference with the table. I didn't realize alignment was dependent on whether or not a block's border was visible.
-------------------------------------------------------
|< Go Back WIDGET PAGE |
-------------------------------------------------------
|-----------------------------------------------------|
| Awesome ASCII art table |
Thanks for any advice. I'm just learning CSS and having fun, but this is making me a little batty.
-Joe