如何将这个 div 的内容居中,它是在单击按钮时创建的并且位于 flex div 中?
How to center this div's content, which is created when a button is clicked and is inside a flex div?
提交表单后,页面内容将被替换并显示感谢消息。
它现在进入 <div>
,但设置在左侧。
这是生成的 html
部分:
<div class="row">
<div style="color:#373737;text-align:center">
<h5>Thank you!</h5>
<p>
We will be processing your response!
</p>
</div>
</div>
这是javascript
片:
function saveData() {
var searchForm = document.getElementById('search-form')
var page = document.getElementById("page");
var table = document.getElementById("dtable");
page.innerHTML = "";
table.innerHTML = "";
searchForm.closest("div.row").innerHTML = "<div style='color:#373737;text-align:center'><h5>Thank you!</h5>" +
"<p>We will be processing your response!</p>"+
"</div"
}
感谢您的帮助!
这是一个尝试:
试试这个:
searchForm.closest("div.row").innerHTML = "<div style='color:#373737;text-align:center;display:flex;justify-content:center;align-items:center;flex-direction:column'><h5>Thank you!</h5>" +
"<p>We will be processing your response!</p>"+
"</div"
提交表单后,页面内容将被替换并显示感谢消息。
它现在进入 <div>
,但设置在左侧。
这是生成的 html
部分:
<div class="row">
<div style="color:#373737;text-align:center">
<h5>Thank you!</h5>
<p>
We will be processing your response!
</p>
</div>
</div>
这是javascript
片:
function saveData() {
var searchForm = document.getElementById('search-form')
var page = document.getElementById("page");
var table = document.getElementById("dtable");
page.innerHTML = "";
table.innerHTML = "";
searchForm.closest("div.row").innerHTML = "<div style='color:#373737;text-align:center'><h5>Thank you!</h5>" +
"<p>We will be processing your response!</p>"+
"</div"
}
感谢您的帮助!
这是一个尝试:
试试这个:
searchForm.closest("div.row").innerHTML = "<div style='color:#373737;text-align:center;display:flex;justify-content:center;align-items:center;flex-direction:column'><h5>Thank you!</h5>" +
"<p>We will be processing your response!</p>"+
"</div"