Jump to content

CSS Alignment in DIV tag


Go to solution Solved by QuickOldCar,

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;

  • Solution

Mixed them up

 

just width overflow

overflow-x: auto;

 

just height overflow
overflow-y: auto;

 

Ohh, and make sure you quote your attributes

<div id="contentsize">
Edited by QuickOldCar
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.