in Education by
I want to right align alternate list elements and keep the other left making it a ZIG-ZAG list Something like.. Item1 Item2 Item3 Item4 I was able to achieve this but without the bullets the bullets of right were still in the left so how do i do that with the bullets...... ul{ list-style-type: none; padding-left: 0; } ul li { margin: 25px 0; padding-left: 45px; } ul li.odd { float:right; } ul li.even { position:relative; }
  • Item1
  • Item2
  • JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You need to create custom bullets with css for this and then use nth-child selector to style them like you want as shown in below snippet. .styled-list { list-style: none; max-width: 200px; padding: 0; margin: 0; } .styled-list li { position: relative; padding-left: 10px; float: left; } .styled-list li:before { border-radius: 100%; position: absolute; background: #000; content: ''; height: 5px; width: 5px; top: 6px; left: 0; } .styled-list li:nth-child(even) { padding-right: 10px; text-align: right; padding-left: 0; float: right; } .styled-list li:nth-child(even):before { left: auto; right: 0; }
  • List Item 1
  • List Item 2
  • List Item 3
  • List Item 4
  • List Item 5
  • List Item 6
  • List Item 7
  • List Item 8
Run code snippetExpand snippet Or you can remove float if you wants this: .styled-list { list-style: none; max-width: 200px; padding: 0; margin: 0; } .styled-list li { position: relative; padding-left: 10px; } .styled-list li:before { border-radius: 100%; position: absolute; background: #000; content: ''; height: 5px; width: 5px; top: 6px; left: 0; } .styled-list li:nth-child(even) { padding-right: 10px; text-align: right; padding-left: 0; } .styled-list li:nth-child(even):before { left: auto; right: 0; }
  • List Item 1
  • List Item 2
  • List Item 3
  • List Item 4
  • List Item 5
  • List Item 6
  • List Item 7
  • List Item 8
Run code snippetExpand snippet

Related questions

0 votes
    I have the following HTML This is going to be big title Foo Bar FooBar BarFoo The text does not ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 9, 2022 in Education by JackTerrance
0 votes
    I have the following HTML This is going to be big title Foo Bar FooBar BarFoo The text does not ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 9, 2022 in Education by JackTerrance
0 votes
    I have this grid: If I change the tables width from 100% to auto, table collapses horizontally. Which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    As the title says, why does my html template look different on three different screen sizes? I understand ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I'm currently working on a project converting some training materials from one e-learning system to another, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    ◙ How many alignment values we use along with align attribute of ? 3 4 5 6 Select the correct answer from above options...
asked Dec 15, 2021 in Education by JackTerrance
0 votes
    I'm currently trying to use lightbox in my project! And as you notice I using a (v-for) for the ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I have a 9-cell grid containing images (using bootstrap columns). The grid works fine and is responsive ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Blurry Image Original image I have a simple image upload function in php. It takes an image and uploads it to ... below for the upload and the calling. gallery.php uploadFile.php...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    I am using a table to display data .I am trying to remove space from the left and right of th ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    Now that most of the major browsers support full page zoom (at present, the only notable exception being ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    I have something like this First table Second table And the following CSS table { margin-bottom:40px; } ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 3, 2022 in Education by JackTerrance
0 votes
    I have something like this First table Second table And the following CSS table { margin-bottom:40px; } ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
...