简体   繁体   English

表格内p标签的CSS

[英]css for p tag inside form

I want to leave some space before the p tag.But now I is sticked to the left side.I want to leave 100px before the p tag. 我想在p标签之前保留一些空间,但是现在我被留在了左侧,我想在p标签之前保留100px。 I attached my css and html.There name and email is stricked to the left position. 我附上了我的CSS和html.There的名称和电子邮件被删除在左侧位置。

 p { margin-left:100px; } .outer { margin-left: 20%; margin-top: 0%; margin-bottom: 3%; height: 737px; width: 60%; box-shadow: 10px 10px 5px #888888; border: 1px solid #f9f2f2; border-radius: 10px; } button.logout { display:inline; float:right; margin-right:10px; margin-left: 5px; } .lout { float: right; display: inline-block; margin-top:20px; } .log { width:60%; height: 10%; position:absolute; border: 1px solid #f9f2f2; border-radius: 10px; border: 0px solid #f9f2f2; text-align: center; line-height:20px; border-width: 0px 0px 1px 1px; display:inline-block; } .rest { padding:7%; height: 580px; padding: 10% 7px; } .sidemenu { float: left; margin-top: 140px; width: 100%; } hr { margin: 0; width: 1px; height: 658px; border: 0; background: #000; float: left; } .content { } .side { width: 24%; float: left; display: inline-block; } 
 <div class="outer"> <div class="log"> <form name="profile" method="post" class="lout"> <button class="done" name="done">Done</button> <button class="logout" name="logout">Logout</button> </div><!--End of log div --> <div class="rest"> <div class="side"> <div class="sidemenu"></div> </div><!--End of side div --> <hr> <div class="content"> <h1>Profile</h1> <br> <br> <br> <br> <p>name</p> <p>email</p> </form> </div><!--End of content --> 

Your <div class="side"> has a float: left . 您的<div class="side">具有float: left But since the div is short and your <div class="content"> is longer, it wraps around the side div. 但是由于div较短,而您的<div class="content">较长,因此它会缠绕在侧面div周围。 All you need is a floating for the content as well: 您所需要的只是内容的浮动:

.content {
  float: left;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM