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!

Box Size

Status
Not open for further replies.

mekohler

Technical User
May 4, 2007
64
CA
I would like a paragraph to have a border around it, but when I create a border, it streches along the length of screen. Is there a setting that allows you to set the length and height of a box? I use the following code:
<style type="text/css">
#InuvikBox {
border: 2px solid black;
width: 75%;
float:left;
margin-right:
}
img {float:right;
}
</style>
If I set the page to 2 columns, will the box only strech the width of the column?
Thanks,
Michael Kohler
 
The box, as you have it defined, will stretch 75% of it's container. If the container is 100px, that will be 75px, if it is 500px 375px, and with 1000px 750px. You can of course set any other width (in any other unit) you would prefer.

You can also limit the height of a container, but be aware that a container with a limited width and height can only hold a certain amount of content. If there's more content you try to put in it, the content will spill out.

I hope that answers your question.

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
The other option is to make the paragraph 'inline', which will give you a box exactly the same width and height as your content, and no bigger.

Unfortunately, if the text wraps on to more than one line, the box will not be rectangular, but stagger depending on the lines of text.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Thank you for the replies. I used px instead of % and I got the results that I was looking for.
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top