【[html5]你还分不清楚绝对定位和相对定位......】

相对定位一般配合绝对定位使用

- <template>
- <view class="content">
- <view style="background-color: black;width: 100%;height: 300px;position:relative;">
- <view class="one">
- 1
- view>
- view>
- <view style="background-color:antiquewhite;width: 100%;height: 1000px;position:relative;">
-
- view>
- view>
- template>
- <script>
-
- export default {
- data() {
- return {
-
- }
- },
- onReady(res) {
-
- },
- created() {
-
- },
- methods: {
-
- }
- }
- script>
- <style>
- .one{
- width: 100px;
- height: 100px;
- background: #0ff;
- position: sticky;
- left: 100px;
- top:100px;
-
-
- }
- style>