控制表中<p>元素之间的空间

时间:2018-12-19 15:15:59

标签: css

我说我有一张桌子:

include('smtp.php');
include('smtpserver.php');
$name = $email = $subject = $message = $phone = $ostan = $place =  "";
$cctvtype = $add = $numCctv = $heightCctv = $cable = $duct = $addons = $success = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
    if (empty($_POST["name"])){
        $name_error = "نام خود را بنویسید";
    }else{
        $name = test_input($_POST["name"]);
        if(!preg_match("/^[a-z A-Z] *$/" ,$name));{
            $name_error = "نام خود را صحیح وارد نمایید";
        }
    }
    if (empty($_POST["phone"])){
        $phone_error = "شماره همراه و یا ثابت خود را وارد نمایید";
    }else{
        $phone = test_input($_POST["phone"]);
        if (!preg_match('/^[0-9]*$/', $id)) {
            $phone_error ="شماره همراه و یا ثابت خود را دقیق وارد نمایید";
        }
    }    
}


if($name_error == "" and $phone_error == ""){

    $userIp= $_SERVER['REMOTE_ADDR']; 
    $name = $_POST['name']; 
    $email = $_POST['email']; 
    $subject = "نصب و راه اندازی  - $name"; 
    $message = $_POST['message']; 
    $phone = $_POST['phone'];
    $ostan = $_POST['province'];
    $place = $_POST['place'];
    $cctvtype = $_POST['cctvtype'];
    $add = $_POST['address'];
    $numCctv = $_POST['tedadd'];
    $heightCctv = $_POST['ertefaenasb'];
    $cable = $_POST['cable'];
    $duct = $_POST['duct'];
    $addons = $_POST['addons'];

    $header = "From: $email\n". "Reply-To: $email\n";
    $header .= "Content-Type: text/plain; charset=UTF-8\n";
    $sub = '=?UTF-8?B?'.base64_encode($subject).'?=';
    $email_to = "mrvahidazimi@gmail.com";
    $content = "آی پی مخاطب: $userIp\n"
        . "نام و نام خانوادگی: $name\n"
        . "پست الکترونیک: $email\n"
        . "موضوع پیام: $subject\n"
        . "شماره تلفن: $phone\n"
        . "استان: $ostan\n"
        . "آدرس: $add\n"
        . "نوع مکان: $place\n"
        . "نوع دوربین: $cctvtype\n"
        . "تعداد دوربین: $numCctv\n"
        . "ارتفاع نصب: $heightCctv . 'متر' \n"
        . "متراژ کابلکشی: $cable . 'متر' \n"
        . "متراژ داکت: $duct . 'متر' \n"
        . "متعلقات: $addons\n"
        . "متن پیام: $message\n";
    if($_SERVER["REQUEST_METHOD"] == "POST"){
        $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $email, $email_to, $sub, $content, $header);
        $SMTPChat = $SMTPMail->SendMail();
        $success = "درخواست شما با موفقیت ارسال شد بزودی با شما تماس خواهیم گرفت";
        $name = $email = $subject = $message = $phone = $ostan = $place = "";
        $cctvtype = $add = $numCctv = $heightCctv = $cable = $duct = $addons = "";
    }

} 
function test_input($data){
    $data = trim($datda);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}

该表如下所示:

enter image description here

让我们说我想控制每个"<table border=1>" + "<tr width=100%>" + "<th width=50% align='left'><b>Adapted Preliminary Flood Hazard Information</b>" + "</tr>" + "<tr width=100%>" + "<td id='small-lines' width=20%><p>What is <span class='tooltip'>Adapted Preliminary’" + popup1 + "</span> Hazard Information?</p>" + "<p><span class='tooltip'>What is my property's flood zone’" + popup2 + "</span> <b>" + graphic.attributes.EFF_FLD_ZN + "</b></p>" + "<p><span class='tooltip'>What is my property's Post-Storm 1% Elevation’" + popup3 + "</span> <b>" + graphic.attributes.str_con_LPE + " - " + graphic.attributes.str_con_HPE + "</b></p>" + "<p><span class='tooltip'>Whats my property's Post-Storm 0.2% Elevation’" + popup4 + "</span> <b>" + graphic.attributes.str_con_LPE + "</b></p>" + "<p><span class='tooltip'>What is my property's observed storm elevation’" + popup5 + "</span> <b>" + graphic.attributes.str_con_HPE + "</b></p>" + "<p><span class='tooltip'>Was there erosion on my property based on the event’" + popup6 + "</span> <b>Yes</b></p>" + "<p><span class='tooltip'>Is my property within a 30 year erosion risk area’" + popup8 + "</span> <b>" + graphic.attributes.PARCELID + "</b></p>" + "<p><span class='tooltip'>Is my property within a 60 year erosion risk area’" + popup9 + "</span> <b>" + graphic.attributes.PARCELID + "</b></p>" + "<p><span class='tooltip'>View your property's Storm Event Elevation on our <a href='http://portal.nwfwmdfloodmaps.com/' class='tooltip'>Event Web Viewer." + popup10 + "</a></p>" + "<p>Where can I get <a href='http://portal.nwfwmdfloodmaps.com/' class='tooltip'>GIS Data" + popup11 + "</a> for my property area’</p>" + "<p></p>" + "</td > " + "</tr>" + "</table>" 之间的空间。也许我想使它们更加紧密。我假设我需要一些CSS,但是我不确定如何正确应用它来缩小<p>段落中默认换行符之间的空间。有什么建议吗?

2 个答案:

答案 0 :(得分:1)

使用:

p { margin:0 }

这会使它们变紧

什么是CSS保证金? Click here

答案 1 :(得分:1)

您可以使用p { margin: 5px 0; },其中5px是您实际希望的段落之间的间隔。 (第一个数字指定顶部/底部边距,第二个数字指定左侧/右侧边距。)