gpt4 book ai didi

php - 无法正确获取边距

转载 作者:太空宇宙 更新时间:2023-11-04 07:14:01 24 4
gpt4 key购买 nike

我一直在开发一个联系系统 - 我让它工作,回复,一切 - 但边距太离谱了 - 见图片 - 有没有人知道我做错了什么?它也是居中的,我希望它在左边。

我在下面列出了我的 index.php 和 styles.css。我必须将它集成到现有网站中 - www.londonontariomortgages.ca/blog.html - 所以我正在考虑做 iFrame - 但是,当它超过边缘时它不会创建一个新行,它看起来很愚蠢。

enter image description here

索引.php

<?php require_once 'php/connect.php'; require_once 'php/functions.php'; ?>
<!doctype html>
<html>
<head>
<title>YouTube Comment System Series</title>
<meta charset="UTF-8" lang="en-US">
<link rel="stylesheet" href="style.css">
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="js/global.js"></script>
</head>
<body>

<p>
<div class="page-container">
<?php
get_total();
require_once 'php/check_com.php';
?>
<form action="" method="post" class="main">
<label>enter a brief comment</label>
<textarea class="form-text" name="comment" id="comment"></textarea>
<br />
<input type="submit" class="form-submit" name="new_comment" value="post">
</form>
<?php get_comments(); ?>
</div>
</p>
</body>
</html>

样式.php

@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);

/* resets */
* {
margin:0px;
padding:0px;
box-sizing:border-box;
font-family:'Calibri', sans-serif;
outline:none;
}

/* Animations */
@keyframes shake {
10%, 90% {
transform: translate3d(-1px, 0, 0);
}
20%, 80% {
transform: translate3d(2px, 0, 0);
}
30%, 50%, 70% {
transform: translate3d(-4px, 0, 0);
}
40%, 60% {
transform: translate3d(4px, 0, 0);
}
}

/* body, html */
html, body {
background-color:#edf1f5;
}

/* content */
.page-container {
width:80%;
height:auto;
min-height:100vh;
margin:0 auto;
padding:50px 10px 0px 10px;
}
.comment {
width:45%;
height:auto;
padding:7px 23px;
margin:0px auto;
margin-bottom:10px;
text-align:left;
}
.child {
margin-top:10px;
margin-left:30px;
padding-left:5px;
}
.child-comments {
border-left:1px solid rgba(1,1,1,0.2);
}

form.main {
width:45%;
margin:0 auto;
margin-top:5px;
}
.form-input {
border:1px solid rgba(1,1,1,0.3);
width:50%;
padding:4px 7px;
font-size:13px;
line-height:24px;
resize:none;
}
.form-text {
border:1px solid rgba(1,1,1,0.3);
width:100%;
padding:4px 7px;
margin-top:5px;
font-size:13px;
line-height:24px;
resize:none;
transition:ease 0.2s all;
outline:none !important;
}
.form-text-error {
border-color:rgba(237,28,36,0.7);
animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
perspective: 1000px;
}
.form-text:focus {
border-color:rgba(0,114,188,0.7);
}
.form-submit {
text-transform: uppercase;
border:1px solid rgba(1,1,1,0.3);
cursor:pointer;
padding:5px 13px;
margin-top:5px;
}

/* fonts */
.user, .time {
display:inline-block;
}
.user {
font-size:13px;
color:#0072bc;
text-decoration: none;
word-break: break-all;
line-height:17px;
}
.time {
font-size:11px;
color:#b2b1b1;
transition:ease 0.2s all;
}
.comment:hover .time {
color:#767676;
}
.comment-text {
font-size:13px;
line-height:17px;
color:#222;
margin:0px 10px;
}
a {
font-size:11.2px;
text-transform: uppercase;
text-decoration: none;
color:#222;
cursor:pointer;
transition:ease 0.3s all;
}
a:hover {
color:#0072bc;
}
.link-reply {
color:#767676;
margin-left:20px;
}

h1 {
width:45%;
height:auto;
margin:0px auto;
font-size:16px;
font-weight:300;
text-transform: uppercase;
border-bottom:1px solid rgba(1,1,1,0.2);
}

label {
font-size:13px;
text-transform: uppercase;
vertical-align: bottom;
}

最佳答案

查看更新后的 CSS,我删除了 margin: auto来自 .page-containerform.main和“.comment”

这导致页面上的表单居中而不是默认的左对齐。

添加此 CSS 以修复文本未换行的问题

.comment-text {
font-size: 13px;
line-height: 17px;
color: #222;
margin: 0px 10px;
word-break: break-all;
}

您的评论没有换行,因为其中没有空格。因此,要打破其中没有空格的元素,您需要添加 word-break: break-all明确破坏它们的属性。

在理想情况下,您的评论中肯定会有空格,您不需要它(断字),但是测试人员(测试您的网站)将使用任何虚拟数据对其进行测试,因此您需要做好准备并针对此问题普遍应用修复程序。

@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700);

/* resets */

* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
font-family: 'Calibri', sans-serif;
outline: none;
}


/* Animations */

@keyframes shake {
10%,
90% {
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
transform: translate3d(2px, 0, 0);
}
30%,
50%,
70% {
transform: translate3d(-4px, 0, 0);
}
40%,
60% {
transform: translate3d(4px, 0, 0);
}
}


/* body, html */

html,
body {
background-color: #edf1f5;
}


/* content */

.page-container {
width: 80%;
height: auto;
min-height: 100vh;
padding: 20px 10px 0px 10px;
}

.comment {
width: 45%;
height: auto;
padding: 7px 0;
margin-bottom: 10px;
text-align: left;
}

.child {
margin-top: 10px;
margin-left: 30px;
padding-left: 5px;
}

.child-comments {
border-left: 1px solid rgba(1, 1, 1, 0.2);
}

form.main {
width: 45%;
margin-top: 5px;
}

.form-input {
border: 1px solid rgba(1, 1, 1, 0.3);
width: 50%;
padding: 4px 7px;
font-size: 13px;
line-height: 24px;
resize: none;
}

.form-text {
border: 1px solid rgba(1, 1, 1, 0.3);
width: 100%;
padding: 4px 7px;
margin-top: 5px;
font-size: 13px;
line-height: 24px;
resize: none;
transition: ease 0.2s all;
outline: none !important;
}

.form-text-error {
border-color: rgba(237, 28, 36, 0.7);
animation: shake 0.82s cubic-bezier(.36, .07, .19, .97) both;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
perspective: 1000px;
}

.form-text:focus {
border-color: rgba(0, 114, 188, 0.7);
}

.form-submit {
text-transform: uppercase;
border: 1px solid rgba(1, 1, 1, 0.3);
cursor: pointer;
padding: 5px 13px;
margin-top: 5px;
}


/* fonts */

.user,
.time {
display: inline-block;
}

.user {
font-size: 13px;
color: #0072bc;
text-decoration: none;
word-break: break-all;
line-height: 17px;
}

.time {
font-size: 11px;
color: #b2b1b1;
transition: ease 0.2s all;
}

.comment:hover .time {
color: #767676;
}

.comment-text {
font-size: 13px;
line-height: 17px;
color: #222;
margin: 0px 10px;
}

a {
font-size: 11.2px;
text-transform: uppercase;
text-decoration: none;
color: #222;
cursor: pointer;
transition: ease 0.3s all;
}

a:hover {
color: #0072bc;
}

.link-reply {
color: #767676;
margin-left: 20px;
}

h1 {
width: 45%;
height: auto;
margin: 0px auto;
font-size: 16px;
font-weight: 300;
text-transform: uppercase;
border-bottom: 1px solid rgba(1, 1, 1, 0.2);
}

label {
font-size: 13px;
text-transform: uppercase;
vertical-align: bottom;
}
<html>

<head>
<title>YouTube Comment System Series</title>
<meta charset="UTF-8" lang="en-US">
<link rel="stylesheet" href="style.css">
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="js/global.js"></script>
</head>

<body>

<p>
<div class="page-container">
<?php
get_total();
require_once 'php/check_com.php';
?>
<form action="" method="post" class="main">
<label>enter a brief comment</label>
<textarea class="form-text" name="comment" id="comment"></textarea>
<br />
<input type="submit" class="form-submit" name="new_comment" value="post">
</form>
<?php get_comments(); ?>
</div>
</p>
</body>

</html>

关于php - 无法正确获取边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50888659/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com