Bootstrap css display fixed
时间: 2023-08-18 08:14:11 浏览: 108
`display: fixed` is not a valid CSS property. The correct property for fixing an element in a specific position on the screen is `position: fixed`. Here's an example:
```html
<div style="position: fixed; top: 0; left: 0;">This element is fixed to the top left of the screen</div>
```
In Bootstrap, you can use the class `fixed-top` or `fixed-bottom` to fix an element to the top or bottom of the screen respectively. For example:
```html
<nav class="navbar fixed-top">This navbar is fixed to the top of the screen</nav>
```
You can also use the class `sticky-top` to make an element stick to the top of the screen until it reaches a certain point, at which point it becomes fixed. For example:
```html
<div class="sticky-top">This element is sticky until it reaches the top of the screen, then it becomes fixed</div>
```
阅读全文