Jump to content

Placing something next to a block level element


Eiolon

Recommended Posts

I am using a header tag (<H2></H2>) and am wondering how I could play something on the opposite end, but outside of the <H2></H2> tag as depicted below:

 

css.jpg

 

My styling:

 

h2 {
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
color:#2858A6;
padding-bottom:5px;
border-bottom:1px dotted #DDDDDD;
}

 

Do I need to create a new DIV and tell it an absolute position to go there or is there another way?

Link to comment
Share on other sites

 

 

 

 

 

.left {
float: left;
width: 50%;
text-align: left;
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
color:#2858A6;
padding-bottom:5px;
border-bottom:1px dotted #DDDDDD;
}
.right
{
float: right;
width: 50%;
text-align: right;
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
color:red;
padding-bottom:5px;
border-bottom:1px dotted #DDDDDD;
}

//////then your html

<h2 class="left">text on the left</h2>
<h2 class="right">text on the right</h2>

 

Maybe the code above would work for you.

Link to comment
Share on other sites

Hey, just tested out the code I presented in Firefox 4.  Didn't quite work. Required setting margin and padding to 0 for both left and right class as below.  Seems to work.

 

 

 

 

 

 

 

.left {
margin: 0;
padding: 0;
float: left;
width: 50%;
text-align: left;
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
color:#2858A6;
padding-bottom:5px;
border-bottom:1px dotted #DDDDDD;
}
.right
{
margin: 0;
padding: 0;
float: right;
width: 50%;
text-align: right;
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
color:red;
padding-bottom:5px;
border-bottom:1px dotted #DDDDDD;
}

//////then your html

<h2 class="left">text on the left</h2>
<h2 class="right">text on the right</h2>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.