这是我的盒子代码。 下面是浏览器中的外观。我试过了text-align:center,box-align:center和position:相对。这些都不起作用。我想念什么?
答案 0 :(得分:0)
尝试一下:
function myFunction(){
document.getElementById("myP").style.textAlign = "center";
}
.blue {
background-color: #0074D9;
width: 100px;
height: 100px;
display: inline-block;
}
<html>
<body>
<center><h2>Click the Box</h2></center>
<div id="myP" onclick="myFunction()">
<div class="blue"></div>
</div>
</body>
</html>
答案 1 :(得分:0)
我希望您希望在单击按钮或框时将框居中对齐。
如果该框是div ...
---------------------------------------------------------------------------
Py4JJavaError Traceback (most recent call last)
<ipython-input-7-99998e5c7b17> in <module>()
----> 1 textFile.count()
Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.
: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1.0 failed 1 times, most recent failure: Lost task 0.0 in stage 1.0 (TID 4, localhost, executor driver): org.apache.spark.SparkException: Python worker failed to connect back.
at org.apache.spark.api.python.PythonWorkerFactory.createSimpleWorker(PythonWorkerFactory.scala:170)...
使用...
<div class="box" onclick="alignCenter()">
</div>
结帐Codepen: