Jump to content

CSS Alignment in DIV tag


prasanna2166

Recommended Posts

Hello Everyone,

 

As I am a novice, posting this simple question.

 

Am trying to design my first webpage using PHP. I have successfully created a wrapper page (index.php) as in the attachment whereas I get into trouble when I try to include PHP content pages into index.php.

 

 

The real problem occurs in the alignment and not with the include command. The problem seems not to go away even if I match the height and width of #contentsize to #rcontent.

 

 
post-173789-0-05610800-1417755196_thumb.jpg
 
PHP:
 
<div id="rcontent">
<div id=contentsize>
<?php
include 'home.php';
?>
</div>
</div>
 
CSS:
#rcontent
{
width:894px;
height:530px;
background-color:blue;
float:right;
border-color:white;
border-width:5px 3px 5px 3px;
border-style:solid;
}
 
#contentsize
{
width:894px;
height:530px;
}

 

Could someone help me out? 

Expected Result: PHP contents should fit in blue box.

 

Thanks in Advance!!

 

Link to comment
https://forums.phpfreaks.com/topic/292907-css-alignment-in-div-tag/
Share on other sites

The problem is you are setting a height and it follows that rule.

 

If you want the content to continue try a min-height

#rcontent
{
width:894px;
min-height:530px;
background-color:blue;
float:right;
border-color:white;
border-width:5px 3px 5px 3px;
border-style:solid;
}

#contentsize
{
width:894px;
min-height:530px;
}

if you want to retain the content within that area try a max-height and overflow: auto;

#rcontent
{
width:894px;
min-height:530px;
background-color:blue;
float:right;
border-color:white;
border-width:5px 3px 5px 3px;
border-style:solid;
}

#contentsize
{
width:894px;
max-height:530px;
overflow: auto;
}

just height overflow

overflow-x: auto;

 

just width overflow
overflow-y: auto;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.