Materialize css input range [duplicate]

2019-09-21 21:14发布

问题:

This question already has an answer here:

  • Difference between style = “position:absolute” and style = “position:relative” 9 answers

I was wondering how to have the value of the range to show up when scrolling the range input

<form action="#">
                                                  <h5>The Temperature</h5>
                                                  <!--the temperature-->
                                                    <p class="range-field">
                                                      <input type="range" id="temp" min="0" max="100" />

                                                    </p>

回答1:

When working with position: relative; the way the object in question is positioned is indeed relative to page margins of your document or relevant container. So for example, of you had a header that you wanted to be positioned in the upper left hand corner of the screen, then the code may look something like this.

h1 {
position: relative;
top: 5px;
right: 5px;
}

Now compare that to position: absolute; where elements are positioned in relation to the browser window or parent element. So while relative positioning does not affect any other elements other than what is specifically targeted, absolute positioning can result in overlapping elements because objects are being placed in specific locations. If you wanted to position an image in the lower right corner of the screen, for instance, your code may look something like this.

img {
position: absolute;
bottom: 0px;
right: 0px;
}