tangteng78
asked on
Checkbox and label not indented properly
Just need to get the checkbox and label to be on the same line and indented properly.
Any help is greatly appreciated :)
See the code:
<head runat="server">
<title></title>
<style type="text/css">
#cbRedeem {
display: none;
}
#cbRedeem + label
{
float: left;
width: 50px;
height: 50px;
background: url('Image/Control/checkbo x_unchecke d.jpg');
background-repeat: no-repeat;
}
#cbRedeem:checked + label
{
float: left;
width: 50px;
height: 50px;
background: url('Image/Control/checkbo x_checked. jpg');
background-repeat: no-repeat;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:CheckBox ID="cbRedeem" runat="server" Text="blah blah blah" Checked="false" AutoPostBack="true" Font-Bold="true" />
<label for="cbRedeem"></label><br />
</form>
</body>
checkbox-not-indented.jpg
Any help is greatly appreciated :)
See the code:
<head runat="server">
<title></title>
<style type="text/css">
#cbRedeem {
display: none;
}
#cbRedeem + label
{
float: left;
width: 50px;
height: 50px;
background: url('Image/Control/checkbo
background-repeat: no-repeat;
}
#cbRedeem:checked + label
{
float: left;
width: 50px;
height: 50px;
background: url('Image/Control/checkbo
background-repeat: no-repeat;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:CheckBox ID="cbRedeem" runat="server" Text="blah blah blah" Checked="false" AutoPostBack="true" Font-Bold="true" />
<label for="cbRedeem"></label><br
</form>
</body>
checkbox-not-indented.jpg
ASKER
Just checked. There is no repeated ids.
Here you go the actual page http://www.toypanic.com/testing1.aspx
Believe the culprit is the CSS. If someone able to help, it would be great.
Here you go the actual page http://www.toypanic.com/testing1.aspx
Believe the culprit is the CSS. If someone able to help, it would be great.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A) You seem to have two labels for the checkbox - one in the <span> and one after itYou can probably remove the following line from your source.
<label for="cbRedeem"></label><br />
ASKER
Right on.
Without any css, everything lines up. Perhaps you can post a link to your sample page to look at.
Also, make sure you are applying your css to classes and not id's. There can only be one ID but you can have multiple classes. I am not a .NET dev, but it seems a lot of people programming in .NET tend to repeat ID's and that can play havoc with your front end code.
http://jsbin.com/dujino/1/edit
Open in new window