Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Those cute right-aligned promoboxes 1

Status
Not open for further replies.

Rydel

Programmer
Feb 5, 2001
376
CZ
Here is the URL:
I am trying to make a CSS definition for a nice little right-aligned promobox with fixed width that I could place anywhere on the page.

So far I've made a solution which makes some sort of "promobox", but has two flaws:
- I can only place it in between paragraphs, because it's with <p> tag
- If I add padding definition, somehow all other paragraphs become unwrapped and each paragraph turns into a loooooong single line.

Also, please note, that I only looked at it in IE 5.5. I wonder how it looks in other browsers.

Here is the code:

Code:
<style>
p.promobox
{
 float: right;
 background-color: #e9e9e9;
 width: 150 pt;
 border-top-style: solid;
 border-top-color: #c0c0ff;
 border-top-width: 1px;
 border-bottom-style: solid;
 border-bottom-color: #c0c0ff;
 border-bottom-width: 1px;
 font-family: Arial, Helvetica, sans-serif;
 font-size: 10pt;
 font-weight: bold;
}
</style>


And here you can see how it looks:


Any help is greatly appreciated! If you are to busy to give a detailed answer, may be you could give me URL with similar promoboxes.



---
---
 
Hi Rydel,

Can't you just make a style like:

<style>
.promobox
{
.......
}

and add it to a <div> like:

<div class=&quot;promobox&quot;>

Maybe that will work,
Erik






<!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
I've tried that before, and it didn't work. The problem was that then the rest of the paragraph that followed <span></span> block somehow &quot;forgot&quot; its style definition and was displayed in default font family and font size. But now I tried again, and it (miraculously) worked. Thanks.

But the second problem remains -
If I add some padding, e.g.

Code:
padding-top: 5%;
 padding-bottom: 5%;
 padding-left: 5%;
 padding-right: 5%;

All the other paragraphs become unwrapped, all becoming single long lines.
---
---
 
Hi Rydel,

Set the padding in px instead of % and it will work for <div> as well as <span>

padding-top: 5px;
padding-bottom: 5px;
padding-left: 5px;
padding-right: 5px;

Hope this helps,
Erik
<!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top