#0aaafd
. This color is used to indicate links. And we need it to create rounded squares-substrates (one - to highlight the current page, the second - to highlight the effect :hover
). For the substrate of the current page, I use 80% color saturation, i.e. #3bbbfd
. For the substrate appearing with the :hover
effect :hover
I use 20% color saturation, i.e. #ceeeff
.ol
). Create markup:We assign a class to the list so that it is possible to manipulate this particular container and the elements inside it. I decided to make the first and last 2 elements of the navigator (the first page, the previous page, the next page, the last page) in the form of pictures, since they "replace" with themselves the content. The current page is highlighted with Strong (we just need bold font).
- 7
- eight
- 9
- ten
- eleven
ol
tag :clear:both;
display:block;
width:181px;
margin:0 auto;
The first rule prohibits wrapping.ol
for our navigator is calculated by the formula:[ ol] * ( [ li] + [ li] + [ li] )
9 * ( 18 + 1 + 1 )
, we get 180. However, IE lacks 180 pixels, and the navigator floats:li
tag :list-style:none;
display:block;
float:left;
margin:0 1px;
The first rule prohibits the display of the sequence number of a list item.display:block;
width:18px;
background:none;
text-align:center;
font:normal 14px/18px Arial, Helvetica, sans-serif;
The first rule is necessary for the second to work. That is, width does not work in inline elements.a:hover
effect :background:url("img/ps-bg.gif") no-repeat left bottom;
The rule "says" about using a background image. But everything is not as simple as it seems at first glance. If we just create a picture for the :hover
effect, when the page loads, the browser will not load it (since it is not displayed when the page loads).:hover
only works for links.ps-bg.gif
, 18 pixels wide and (18 + 18) high. The bottom “half” is for a hover effect, the top one is for the current page.li
) 18x18 are ready for us, you can fill them with contents. It remains for us to issue 2 tags - strong
and img
. Design for the text of the links we are ready.strong
tag :display:block;
width:18px;
color:white;
background:url("img/ps-bg.gif") no-repeat left top;
text-align:center;
font:bold 14px/18px Arial, Helvetica, sans-serif;
Here, only the fourth rule is of interest - “we cut out the upper part of ps-bg.gif and insert it into the 1818 container”.img
tag :width:18px;
.page-scroll {
clear:both;
display:block;
width:181px;
margin:0 auto;
}
.page-scroll li {
list-style:none;
display:block;
float:left;
margin:0 1px;
}
.page-scroll a {
display:block;
width:18px;
background:none;
text-align:center;
font:normal 14px/18px Arial, Helvetica, sans-serif;
}
.page-scroll a:hover {background:url("img/ps-bg.gif") no-repeat left bottom;}
.page-scroll strong {
display:block;
width:18px;
color:white;
background:url("img/ps-bg.gif") no-repeat left top;
text-align:center;
font:bold 14px/18px Arial, Helvetica, sans-serif;
}
.page-scroll img {width:18px;}
.page-scroll {
clear:both;
display:block;
width:181px;
margin:0 auto;
}
.page-scroll li {
list-style:none;
display:block;
float:left;
margin:0 1px;
}
.page-scroll a {
background:none;
font:normal 14px/18px Arial, Helvetica, sans-serif;
}
.page-scroll a:hover {background:url("img/ps-bg.gif") no-repeat left bottom;}
.page-scroll strong {
color:white;
background:url("img/ps-bg.gif") no-repeat left top;
font:bold 14px/18px Arial, Helvetica, sans-serif;
}
.page-scroll strong, .page-scroll a, .page-scroll img {
display:block;
width:18px;
text-align:center;
}
Look at the working navigatorSource: https://habr.com/ru/post/18036/
All Articles