【前端寻宝之路】学习和总结CSS的字体属性设置

](https://img-home.csdnimg.cn/images/20220524100510.png#pic_center)

🌈个人主页: Aileen_0v0
🔥热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法|MySQL|
💫个人格言:“没有罗马,那就自己创造罗马~”

be available to sb.可用,可供

CSS常用属性

学习链接:CSS常用属性

字体设置

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            font-family: '宋体';
            font-size: 80px;
        }

    </style>
</head>
<body>
    <div>这是宋体</div>
</body>
</html>

在这里插入图片描述


字体大小

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            font-family: '宋体';
            font-size: 80px;
        }

    </style>
</head>
<body>
    <div>这是宋体</div>
</body>
</html>

在这里插入图片描述


字体颜色

  • 1.直接写颜色的英文单词
color : red ;
  • 2.通过十六进制表示
color : #ff0000 ;
  • 3.通过rgb表示
color : rgb(225,0,0) ;
其中,第二种和第三种表示的都是三原色:红,绿,蓝
数值越大,表示该颜色的分量越浓.
225,225,225就表示白色
0,0,0就表示黑色
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            font-style: oblique;
            color:#f00;
        }
        p {
            font-style:italic;
            color: rgb(0, 0, 225);
        }
    </style>
</head>
<body>
    <div>这是第一段话</div>
    <p>这是第二段话</p>
</body>
</html>

在这里插入图片描述


字体粗细

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            font-weight: bolder;
        }
        p {
            font-weight: lighter;
        }

    </style>
</head>
<body>
    <div>这是第一段话</div>
    <p>这是第二段话</p>
</body>
</html>

在这里插入图片描述


字体样式

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            font-style: italic;
        }
        p {
            font-style:oblique;
        }

    </style>
</head>
<body>
    <div>这是第一段话</div>
    <p>这是第二段话</p>
</body>
</html>

在这里插入图片描述
](https://img-home.csdnimg.cn/images/20220524100510.png#pic_center)

](https://img-home.csdnimg.cn/images/20220524100510.png#pic_center)

  • 30
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 9
    评论
基于强化学习的迷宫宝是一种常见的强化学习应用。在这个应用中,智能体需要在迷宫中找到宝藏,并且需要尽可能快地找到它。在这个过程中,智能体需要学习如何在迷宫中移动,以及如何在不同的位置上采取不同的行动。这个过程可以通过两种不同的强化学习算法来实现:Sarsa和Q-Learning。 Sarsa算法是一种在线学习算法,它可以在智能体与环境交互的同时进行学习。在Sarsa算法中,智能体会根据当前状态和行动来更新它的策略,并且会在下一个状态和行动中使用这个策略。这个过程会一直持续到智能体找到宝藏或者达到了最大的迭代次数。 Q-Learning算法是一种离线学习算法,它可以在智能体与环境交互之后进行学习。在Q-Learning算法中,智能体会根据当前状态和行动来更新它的价值函数,并且会在下一个状态中选择最大的价值函数来更新策略。这个过程会一直持续到智能体找到宝藏或者达到了最大的迭代次数。 下面是一个基于Sarsa算法的迷宫宝的Python代码示例: ```python import numpy as np # 定义迷宫 maze = np.array([ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 1, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 0, 1, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 0, 1, 0, 1, 0], [0, 1, 1, 1, 1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ]) # 定义起点和终点 start = (1, 1) end = (8, 8) # 定义动作和策略 actions = ['up', 'down', 'left', 'right'] policy = np.zeros((10, 10, 4)) q_table = np.zeros((10, 10, 4)) # 定义参数 alpha = 0.1 gamma = 0.9 epsilon = 0.1 max_iter = 1000 # 定义Sarsa算法 def sarsa(): for i in range(max_iter): # 初始化状态和行动 state = start action = np.random.choice(actions) while state != end: # 选择行动 if np.random.uniform() < epsilon: action = np.random.choice(actions) else: action = actions[np.argmax(q_table[state[0], state[1]])] # 更新状态和行动 next_state = tuple(np.array(state) + np.array([0, -1]) * (action == 'up') + np.array([0, 1]) * (action == 'down') + np.array([-1, 0]) * (action == 'left') + np.array([1, 0]) * (action == 'right')) next_action = np.random.choice(actions) if np.random.uniform() < epsilon else actions[np.argmax(q_table[next_state[0], next_state[1]])] # 更新Q值 q_table[state[0], state[1], actions.index(action)] += alpha * (maze[next_state[0], next_state[1]] + gamma * q_table[next_state[0], next_state[1], actions.index(next_action)] - q_table[state[0], state[1], actions.index(action)]) # 更新状态和行动 state = next_state action = next_action # 运行Sarsa算法 sarsa() # 输出策略 for i in range(10): for j in range(10): policy[i, j, np.argmax(q_table[i, j])] = 1 print(policy[:, :, 0], '\n', policy[:, :, 1], '\n', policy[:, :, 2], '\n', policy[:, :, 3]) ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Aileen_0v0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值