css中固定模型与盒子模型的区别 [英] difference between fixed model and box model in css

查看:149
本文介绍了css中固定模型与盒子模型的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道盒子模型是

Quote:

边距,边框,填充和实际内容。

margins, borders, padding, and the actual content.







但是什么是




but what is the

Quote:

fixed model

fixed model

??

推荐答案

CSS Box模型

所有HTML元素都可视为框。在CSS中,在谈论设计和布局时使用术语盒子模型。



CSS盒子模型本质上是一个包装HTML元素的盒子,它包括:边距,边框,填充和实际内容。



框模型允许我们在元素周围添加边框,并定义元素之间的空间。 br $>


div {

宽度:300px;

填充:25px;

border :25px实心海军;

保证金:25px;

}



固定定位

具有固定位置的元素相对于浏览器窗口定位。



即使滚动窗口,它也不会移动:

例子



p.pos_fixed {

position:fixed;

top: 30px;

右:5px;

}
The CSS Box Model
All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design and layout.

The CSS box model is essentially a box that wraps around HTML elements, and it consists of: margins, borders, padding, and the actual content.

The box model allows us to add a border around elements, and to define space between elements.

div {
width: 300px;
padding: 25px;
border: 25px solid navy;
margin: 25px;
}

Fixed Positioning
An element with fixed position is positioned relative to the browser window.

It will not move even if the window is scrolled:
Example

p.pos_fixed {
position: fixed;
top: 30px;
right: 5px;
}


这篇关于css中固定模型与盒子模型的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆