如何在 Pardot 中将表单居中?

How can I center a form in Pardot?

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

我一直在研究 div,答案似乎是 "wrap it in a 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;}

刚刚在 Pardot 中测试并且有效。