Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a div containing an image and a gridview. I have set the image width and height to 125px and would like to have the gridview stretch its width to the remaining space in the div. very unsure how to do this...or why the solution i've tried isn't working.

though it is working in vs web developer's design view lol.

here's the html:
ASP.NET
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">

<div class="mainDiv">
    <div class="picDiv">
        <img width="125px" height="125px"/>
    </div><!-- picDiv -->

    <div class="gvDiv">
        <asp:GridView class="gvHome" ID="homeVolunteerGV" runat="server" 
             AutoGenerateColumns="False" GridLines="Horizontal"
             HorizontalAlign="Center" RowStyle-HorizontalAlign="Center">
             <columns>
                 <column1>
                 <column2>
             </columns>       
    </div><!-- gvDiv -->
</div><!-- mainDiv -->
</asp:Content>


CSS
.mainDiv
{
    width:100%;
    background-color:green;
    height:125px;
}

.picDiv
{
float:left;
}

.gvDiv
{
float:right;
width:100%;
}


thank you.
Posted
Comments
Anoop Kr Sharma 13-Aug-13 22:12pm    
Are you trying to set an image towards left side of mainDiv and want rest portion for .gvDiv? If Yes then check this link Click here to check fiddle.Red background-color here i supposed it is an image here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900