File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes DIV Tag Auto Width and Height Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DIV Tag Auto Width and Height" Watch "DIV Tag Auto Width and Height" New topic
Author

DIV Tag Auto Width and Height

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1446
    
    1
I know that if I set auto width or height on my div tag the content will control the width and height. However, is there a way to control the width and height based on the parent of the div tag? I need on div tag set in the center of a parent div tag at 100% width and height with the padding set to 5px on the inner div tag so it appears to have a border.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61204
    
  66

WHat have you tried so far?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1446
    
    1
Bear Bibeault wrote:WHat have you tried so far?


I have tried things like this but it still adjusts to the size of the content and not the parent container.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61204
    
  66

Seems like you're over-thinking things a bit. Maybe all you need is:

height: 100%;
border: 5px solid red;


or whatever border color you need.

(Assuming that the outer div has a height.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DIV Tag Auto Width and Height