css如何让一行内的文字两端对齐?

html-css015

css如何让一行内的文字两端对齐?,第1张

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:

div{

border: 1px solid blue

width: 300px

text-align: justify

}

div:after {

display: inline-block

width: 100%

content: ''

}

3、浏览器运行index.html页面,此时一行内的文字实现了两端对齐。

打开 vs 选择【工具-选项-文本编辑-CSS-高级】里面的格式设置,最重要的是设置[括号位置]=压缩

选中CSS 使用快捷键:ctrl+KD

你好,代码如下:

<div class="prayer-form">

<p><label><input class="prayer-type" type="radio" name="prayer-type" value="prayer" checked="checked" />Pray</label><label><input class="prayer-type" type="radio" name="prayer-type" value="praise" />Praise</label></p>

<textarea class="prayer-request"></textarea>

<br/>

<div style="display:inline">

First Name<input class="prayer-first-name" type="text" />

Email<input class="prayer-email" type="text" />

</div>

<p class="prayer-submit"><a class="agreement" href="javascript: void(0)">Agreement</a><input type="button" value="Submit" /></p>

</div>