html - List Item First Indentation Not Lining Up -
in each list item have text box within div element.
<html> <body> <!-- window --> <div id="sample_container_id"> <div class="bucket" id="defaultbucket"> <h3>default bucket</h3> <input type="button" value="add" class="button"> <div class="innerbucket"> <ul id="tasks"> <li> <div class="taskdiv"> <input type="text" class="tasktextinput"> </div> </li> <li> <div class="taskdiv"> <input type="text" class="tasktextinput"> </div> </li> <li> <div class="taskdiv"> <input type="text" class="tasktextinput"> </div> </li> </ul> </div> <!-- innerbucket --> </div> <!-- defaultbucket --> </div> </body> </html>
this result:
body { background-color: #f8f8f8; font-family: 'open sans', sans-serif; font-size: 14px; font-weight: normal; line-height: 1.2em; margin: 15px; } h1, p { color: #333; } #sample_container_id { width: 100%; height: 400px; position: relative; border: 1px solid #ccc; background-color: #fff; margin: 0px; } .innerbucket { width: 290px; height: 355px; margin-top: 40px; margin-left: 5px; position: relative; background-color: white; } .bucket { width: 300px; height: 400px; background-color: #ddd; position: absolute; } .bucket h3 { float: left; padding-left: 10px; padding-top: -10px; } .bucket ul { margin: 0; padding-left: 30px; position: relavtive; list-style: none; } .bucket ul li { margin: 0; padding: 0; text-indent: 0.5em; margin-left: -0.5em; display: block; position: relative; } .bucket .button { background-color:#fbb450; border:1px solid #c97e1c; float: right; margin: 5px; display:inline-block; color:#ffffff; font-family:trebuchet ms; font-size:17px; font-weight:bold; padding:2px 11px; text-decoration:none; text-shadow:0px 1px 0px #8f7f24; }
result
as may notice first item indented, , list items aligned on left. how fix css (there lot of things wrong css, trying everything)?
edit
i added more code. should able replicate problem now. didn't want post wall of code :)
solution
i found solution problem. problem <h3>
element. bottom margin forcing first element off side.
adding fixed problem:
.bucket h3 { ... margin-bottom: 0; }
- don't float divs, if make sure clear them or fakerainbrigand got in pen.
- spell relative right matter take positioning out of code, it's pointless.
- list items definition block elements, don't need declare either.
- close input tags.
the float issue, pushing divs against invisible element.
.taskdiv { margin: 0; padding: 0; } ul { margin: 0; padding-left: 30px; list-style: none; } ul li { margin: 0; padding: 0; text-indent: 0.5em; margin-left: -0.5em; }
example: http://jsfiddle.net/calder12/yw4tb/
Comments
Post a Comment