Jump to content

Adding right justified anchor between div tag removes div background color


Peter Robinson

Recommended Posts

My aim was to place title on the left and my table of contents link on the right all on one line within my div tag which defines the color. only I loose the color defined in my div.  

Any suggestions how to solve this ?

<!DOCTYPE html>
<html>
<head>
<title>Test Page Title</title>
<style>
    .alignleft { float: left; }
    .alignright { float: right; }
    div.title1 {background-color:#07E9DA;}

</style>
</head>
<body>
<div>
    <h1><a name="TOC"></a>Table of Contents</h1>
    <ol>
        <li><a href="#section1">Section 1</a>
    </ol>
</div>

<div class="title1">
<!-- <h2><a name="section1" class="alignleft">Section 1</a></h2>  <a href="#TOC" class="alignright">ToC</a></p> -->
 <a name="section1" class="alignleft">Section 1</a> <a class="alignright" href="#toc">toc</a>
</div>
<div>
   <p>This is a paragraph.</p>
</div>
</body>
</html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...