How to make a div tag occupy half the right side of my web page?

This is a basic HTML question.

I have div tags that have some controls and occupy the left half of my screem.

I want to have a div tag to display some messages on the right side? I used things like:

float = right;

in my css class. This does not seem to work. What other properties do I need to set.

Here is a sample code

<div class ="header_label">
@Html.GetLocalizedString("program_snapshotRecipientAdress")&nbsp; @Html.TextBox("txtRcpntAdress")
</div>

   <div class ="header_label">
@Html.GetLocalizedString("program_snapshotUsertype1") &nbsp; @Html.RadioButton("Usertype", "One", new { id="rb1"})
 &nbsp; &nbsp;
@Html.GetLocalizedString("program_snapshotUsertype2") &nbsp; @Html.RadioButton("Usertype", "Two", new { id = "rb2" })
<div class ="commentsHeight"></div>
 </div>
   <div class ="header_label">
@Html.GetLocalizedString("program_snapshotDate") &nbsp; @Html.TextBox("SnapshotDate")
</div>

  <div id ="CMSContent">
<div class ="CMS-message">
@Html.Raw("S=This is the div I need to place in the right hand side")
</div>
</div>
+5
source share
4 answers

I haven’t understood your question so much, but I’ll try to answer. If you have a div on the left and you want another on the right, you have two options:

1) The first is to set one div to the right and the other to the left:

<div>
    <div style="float: left; width: 50%">I'm on the left</div>
    <div style="float: right; width: 50%">I'm on the right</div>
</div>

2) Second - set each div to the left

<div>
    <div style="float: left; width: 50%">I'm on the left</div>
    <div style="float: left; width: 50%">I'm on the second on the left</div>
</div>
+10
source
  • , div?
  • float : right;
    
  • , div , - :

    width : 50%;
    
+1

div, , "", .

"" ..

:

float: right;

CSS, =, html css , .

0

- , : float: right; : 50%;

0

All Articles