Forum : CSS
Brief description  about Online courses   join in Online courses
View ganesh  pradhan 's Profile

CSS

Hi
Actually before also I have asking the same quistion,and you have reply me and iam tried to do the same but its not happening.I tried to bring the float at the right side of the first div its come but bottom of the first div but not in right side.
Asked by ganesh pradhan | Feb 2, 2010 |  Reply now
Replies (3)
View sanjay s nair 's Profile
(1) You have to reduce the width of 2 divs with 400px each to 395px each and the 10px you get from the reduction could be used to create another div which could be used as spacer in between those two divs.

(2) You could use font-size property in css to increase the font size.

Please checkout the code below:

<!-- Code Begins -->
<html>
<head><title>HTML div example</title></head>
<body>

<!-- Container div starts -->
<div style="width:800px">

<!-- div 1 -->
<div style="width:395px;height:100px;float:left;background-color:#CCC;text-align:center;font-size:36px;">div1</div>

<div style="width:10px;float:left;">&nbsp;</div>

<!-- div 2 -->
<div style="width:395px;height:100px;float:left;background-color:#999;text-align:center;font-size:24px;">div2</div>

</div>
<!-- Container div ends -->

</body>
</html>
<!-- Code Ends -->
Feb 3, 2010
View ganesh pradhan 's Profile
(1)How should separated between two div? and(2) how to increase the size of the search text.
Feb 3, 2010
View sanjay s nair 's Profile
You have to set a container div with a specified width say 800px.

Then suppose you need to have two other divs inside first one of 400px each, remember not to exceed 800px of the combined width of 2 divs, even though you include a border of 1px with this two divs it will break off, since 400+400+borderwidth > 800px.

Checkout the code below:


<!-- Code Begins -->
<html>
<head><title>HTML div example</title></head>
<body>

<!-- Container div starts -->
<div style="width:800px">

<!-- div 1 -->
<div style="width:400px;height:100px;float:left;background-color:#CCC;text-align:center;">div1</div>

<!-- div 2 -->
<div style="width:400px;height:100px;float:left;background-color:#999;text-align:center;">div2</div>

</div>
<!-- Container div ends -->

</body>
</html>
<!-- Code Ends -->
Feb 2, 2010