如何在 Pardot 中居中表单



我正在使用Pardot创建一个表单。我正在将此表单链接到我们的主页,并希望表单在打开新窗口时显示为居中。

我一直在研究div,

似乎答案是"将其包装在div 中",但我读到 pardot 不希望某些东西包裹在div 中。这是我正在使用的代码。我试图让所有这些内容在页面中间很好地完成。如果可能的话,水平和一些垂直。您可以看到我试图以代码为中心ontent="width=device-width, initial-scale=1, maximum-scale=1 但这似乎没有任何作用。

<!DOCTYPE html>
<html>
<head>
    <base href="http://go.pardot.com" >
    <meta charset="utf-8"/>
    <meta name="description" content="width=device-width, itintial-scale=1, maximum-scale=1, %%description%%"/>
    <title>%%title%%</title>
    <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
    <style type="text/css">
   #pardot-form p label {
    margin: 0 auto; 
    width:250px;
    color: #003366;
    font-size: 14px;
    width: 165px;
    margin-bottom: 0.5em;
    font-weight: 800;
    font-family: 'Open Sans',sans-serif;
    }   

 #pardot-form.form .no-label .description {
    margin-left: 0;
    color: #003366;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: bold;
    margin-top: 0.15em;
    margin-bottom: 1em;
    }
#pardot-form input.text {
    border-radius: 4px;
    border: 1px solid #DADADA;
    width: 200px;
    height: 2em;
    font-family: 'Open Sans',sans-serif;
    font-size: 14px;
    background-color: white;
    margin-bottom: 10px;
    }
#pardot-form select {
    border-radius: 4px;
    border: 1px solid #DADADA;
    width: 50%;
    height: 2.5em;
    font-family: 'Open Sans',sans-serif;
    font-size: 14px;
    background-color: white;
    margin-bottom: 10px;
    }
#pardot-form textarea.standard {
    border-radius: 4px;
    border: 1px solid #DADADA;
    width: 50%;
    height: 8em;
    font-family: 'Open Sans',sans-serif;
    font-size: 14px;
    background-color: white;
    margin-bottom: 10px;
    }
#pardot-form p.submit input {
    background: #009cdb;
    border: 0 none;
    border-radius: 4px;
    cursor: pointer;
    color: #FFFFFF;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    width: 100px;
    height: 40px;
    }
#pardot-form.form p.submit {
    margin: 0 0 0 200px;
    }
    </style>
</head>
<body>
    %%content%%
</body>

试试

body {
  text-align:center; 
  display: table-cell;
  vertical-align: middle;
}
html {
  height:100%;
  display: table;
  width:100%;
}

附加代码笔

http://codepen.io/anon/pen/xqjqWo 您可能需要将正文和 HTML 分别更改为子项和父项,但您在提供的代码中没有表单元素,因此我相应地将您的内容居中

显然,您还需要将%%content%%替换为表单元素

添加以下内容:

form.form {
display:table;
margin:0 auto !important;}

刚刚在帕多特中测试并工作。

最新更新