html怎样连接到外部css

2024-11-07 10:53:51
推荐回答(5个)
回答1:

1、当我们不导入外部CSS样式表时,我们通常用html编写样式,两种方式使我们共同,第一种为下图。

2、第二种写作方式:

时间元素</ title></p> <p><风格></p> <p>。所有{</p> <p>身高:300像素;</p> <p>宽度:500像素;</p> <p>背景:#999;}</p> <p></样式></p> <p></ HEAD></p> <p><BODY></p> <p><div class =“all”> </ div></p> <p></ BODY></p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2F63d9f2d3572c11dfb89283936d2762d0f703c23a%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/63d9f2d3572c11dfb89283936d2762d0f703c23a"></p> <p>3、链接外部CSS样式,现在创建一个css样式表文件。</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2F6d81800a19d8bc3e27fb3a7a8c8ba61ea9d3458a%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/6d81800a19d8bc3e27fb3a7a8c8ba61ea9d3458a"></p> <p>4、这里鼠标右键单击选择将链接存储在css文件夹中。</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2F241f95cad1c8a7866ac776be6909c93d71cf5094%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/241f95cad1c8a7866ac776be6909c93d71cf5094"></p> <p>5、在html文件中写下链接代码,代码如下:<link rel =“stylesheet”type =“text / css”href =“css / index.css”/>。</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2Fac345982b2b7d0a2553c382dc5ef76094a369a8c%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/ac345982b2b7d0a2553c382dc5ef76094a369a8c"></p> <p>6、之后,您可以看到HTML文件的源代码并查看我们连接的css文件。</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2Fb21c8701a18b87d6d99497af090828381e30fda8%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/b21c8701a18b87d6d99497af090828381e30fda8"></p></p> </div> </div> <div class="clear"></div> </div> <div class="wdhdnr"> <div class="huidanrtop"> <div class="wdhuidaxinx"> <div class="wdhuidaxm">回答2:</div> </div> </div> <div class="clear"></div> <div class="wdhuidanrmid"> <div class="zuijiacont"> <p><p>html网页链接到外部css有两种方法</p> <p>第一种:Dreamweaver直接插入</p> <p>1、用Dreamweaver打开html文件</p> <p>2、在软件右边有个css设计器、文件、资源、插入等选项,点击css设计器,如下图所示</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2Fd009b3de9c82d158ef7a1275870a19d8bd3e427d%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/d009b3de9c82d158ef7a1275870a19d8bd3e427d"></p> <p>3、在css设计器下面的源:所有源前面有个加号,点击之后选择“附加现有的css文件”,如图</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2Fd1160924ab18972b8fbd4b0ee1cd7b899f510a6a%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/d1160924ab18972b8fbd4b0ee1cd7b899f510a6a"></p> <p>4、在弹出的面板中选择链接选项,然后浏览,找到要链接的css文件,然后点击确定即可直接连接到外部css,如图</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2Fb90e7bec54e736d1d410c6cc9c504fc2d46269f7%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/b90e7bec54e736d1d410c6cc9c504fc2d46269f7"></p> <p>第二种:打开Dreamweaver、EditPlus等编辑软件打开html文件,然后在头部<head></head>标签中插入如下代码<link href="css文件路径" rel="stylesheet" type="text/css">,如下图所示</p> <p><img loading="lazy" class="ikqb_img" src="/picurl?url=https%3A%2F%2Fiknow-pic.cdn.bcebos.com%2F962bd40735fae6cd26c3e1a508b30f2443a70ffa%3Fx-bce-process%3Dimage%252Fresize%252Cm_lfit%252Cw_600%252Ch_800%252Climit_1%252Fquality%252Cq_85%252Fformat%252Cf_auto" esrc="https://iknow-pic.cdn.bcebos.com/962bd40735fae6cd26c3e1a508b30f2443a70ffa"></p> <p>以上为两种链接到外部css文件方法及步骤</p></p> </div> </div> <div class="clear"></div> </div> <div class="wdhdnr"> <div class="huidanrtop"> <div class="wdhuidaxinx"> <div class="wdhuidaxm">回答3:</div> </div> </div> <div class="clear"></div> <div class="wdhuidanrmid"> <div class="zuijiacont"> <p>举个栗子:<br><!DOCTYPE html><br><html><br><head><br> <title>日历







XXXX


这里:

这里的地址可以是绝对路劲也可以是项目的相对路径~~~

回答4:

在HTMl页面head区域添加上次代码就可以。

回答5:

在html网页的head里面插入下面的代码,style.CSS就是你的CSS样式文件