Demo
  • 2.49 KB
  • HTML, CSS
  • List
  • MIT License
HTML
<ul>
    <li>The bigger the tank or aquarium the better. Most fish may be small in size, but they still need plenty of room to swim, especially if you have decided to get more than one.</li>
    <li>Think about where you place your tank. Keep it out of direct sunlight, away from windows and heating. The last thing you want is for the water in the tank to heat up out of your control.</li>
    <li>Invest in a decent filter. This will keep the water in the tank cleaner for longer, removing any debris, pollutants and waste.</li>
    <li>Add an air pump. This will keep the water in the tank oxygenated and keep it moving which is great for your fish. Pumps come in different sizes depending on the amount of litres your tank can hold.</li>
</ul>
CSS
ul {
    list-style: none;
    padding: 0;
    max-width: 500px;
}

li + li {
    margin-top: 1rem;
}

li {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    align-items: center;
    gap: 1rem;
    background: aliceblue;
    padding: 1.5rem;
    -webkit-border-radius: 1rem;
    -moz-border-radius: 1rem;
    border-radius: 1rem;
    width: -webkit-calc(100% - 2rem);
    width: -moz-calc(100% - 2rem);
    width: calc(100% - 2rem);
    -webkit-box-shadow: 0.25rem 0.25rem 0.75rem rgb(0 0 0 / 0.1);
    -moz-box-shadow: 0.25rem 0.25rem 0.75rem rgb(0 0 0 / 0.1);
    box-shadow: 0.25rem 0.25rem 0.75rem rgb(0 0 0 / 0.1);
}

li::before {
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512' width='100' title='fish'%3E%3Cpath d='M327.1 96c-89.97 0-168.54 54.77-212.27 101.63L27.5 131.58c-12.13-9.18-30.24.6-27.14 14.66L24.54 256 .35 365.77c-3.1 14.06 15.01 23.83 27.14 14.66l87.33-66.05C158.55 361.23 237.13 416 327.1 416 464.56 416 576 288 576 256S464.56 96 327.1 96zm87.43 184c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24 13.26 0 24 10.74 24 24 0 13.25-10.75 24-24 24z' /%3E%3C/svg%3E");
}

li:nth-child(even) {
    -webkit-box-orient: horizontal;
    -webkit-box-direction: reverse;
    -webkit-flex-direction: row-reverse;
    -moz-box-orient: horizontal;
    -moz-box-direction: reverse;
    flex-direction: row-reverse;
    background: honeydew;
    margin-right: -2rem;
    margin-left: 2rem;
}

li:nth-child(even)::before {
    -webkit-transform: rotateY(180deg);
    -moz-transform: rotateY(180deg);
    transform: rotateY(180deg);
}

The provided content outlines how to properly care for fish in an aquarium, focusing on the importance of choosing a sufficiently large tank, positioning the tank away from direct sunlight and heat sources, investing in a good filter, and adding an air pump to ensure the water remains oxygenated.

The styling section uses CSS to format the list visually: removing the default list style, setting margins for spacing, using flexbox for alignment, and applying background colors and shadows for aesthetic appeal. Specific adjustments are made for even-numbered items, such as reversing the flex direction and changing the background color.

Additionally, a fish icon is inserted before each list item using CSS pseudo-elements, with a rotation effect applied to icons in even-numbered items for visual variety.

Menu