bootstrap学习笔记<三>(文本,代码域,列表)

文本对齐

.text-left:左对齐    .text-center:居中对齐    .text-right:右对齐    .text-justify:两端对齐

 

<p class="text-left">居左</p>
<p class="text-center">居中</p>
<p class="text-right">居右</p>
<p class="text-justify">There is clearly a need for CSS to be taken seriously by graphic artists. The Zen Garden aims to excite, inspire, and encourage participation. To begin, view some of the existing designs in the list. Clicking on any one will load the style sheet into this very page. The code remains the same, the only thing that has changed is the external .css file. </p>
View Code

 

 

 

  ☑   .text-left:左对齐

  ☑   .text-center:居中对齐

  ☑   .text-right:右对齐

  ☑   .text-justify:两端对齐

效果图

 

 列表

<一> bootstrap新增类别list-unstyled。一个属性就能去掉ul li的样式。

<ul class="list-unstyled">
        <li>列表项</li>
        <li>列表项</li>
        </ul>
View Code

class="list-unstyled"

<二>内联列表,简单说就是把ul li的垂直排列变为水平排列。(ps:这个功能相当实用)

<ul class="list-inline">
    <li>W3cplus</li>
    <li>Blog</li>
    <li>CSS3</li>
    <li>jQuery</li>
    <li>PHP</li>
</ul>
View Code

 

class="list-inline"

效果图

 

代码区

bootstrap专为代码设置了3个风格分别为:

1、使用<code></code>来显示单行内联代码
2、使用<pre></pre>来显示多行块代码
3、使用<kbd></kbd>来显示用户输入代码

code风格:
<div>Bootstrap的代码风格有三种:<code>&lt;code&gt;</code><code>&lt;pre&gt;</code><code>&lt;kbd&gt;</code></div>
pre风格:
<div>
<pre>
&lt;ul&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
kbd风格:
<div>请输入<kbd>ctrl+c</kbd>来复制代码,然后使用<kbd>ctrl+v</kbd>来粘贴代码</div>
View Code

 

效果图

 

<二>pre多行代码块y轴滚动

 class="pre-scrollable"

 

高度超出340px,就会在Y轴出现滚动条
<pre class="pre-scrollable">
<ol>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
    <li>....</li>
</ol>
</pre>
View Code

 

 

 

效果图

 

转载于:https://www.cnblogs.com/MirageFox/p/5020056.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以通过调整Bootstrap按钮的样式类来改变按钮的大小和间距。首先,可以使用`btn-lg`、`btn-sm`和`btn-xs`类来设置按钮的大小,分别对应大、小和超小种尺寸。例如,将按钮1设置为大尺寸,可以将`btn-primary`类改为`btn-primary btn-lg`。同样,将按钮2设置为超小尺寸,可以将`btn-secondary`类改为`btn-secondary btn-xs`。 其次,可以使用`mr-*`和`ml-*`类来设置按钮之间的间距。这些类可以控制按钮的右边距和左边距,其中`*`表示间距的大小。例如,将按钮1和按钮2之间的间距设置为20像素,可以为按钮1添加`mr-2`类,为按钮2添加`ml-2`类。 下面是相应的代码示例: ```html <!DOCTYPE html> <html> <head> <title>Bootstrap Buttons</title> <!-- 引入Bootstrap样式文件 --> <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/css/bootstrap.min.css"> </head> <body> <div class="container-fluid d-flex justify-content-center align-items-center" style="height: 100vh;"> <div class="row"> <div class="col-md-12"> <button class="btn btn-primary btn-lg mr-2">Button 1</button> <button class="btn btn-secondary btn-xs ml-2">Button 2</button> </div> </div> </div> <!-- 引入Bootstrap JavaScript文件 --> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.min.js"></script> </body> </html> ``` 在上面的示例中,我们将按钮1的样式类设置为`btn-primary btn-lg mr-2`,将按钮2的样式类设置为`btn-secondary btn-xs ml-2`,从而实现了按钮的大小和间距的调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值