html-lists

Create <select> from list - indent child items?

柔情痞子 提交于 2019-12-04 18:37:00
I have a UL LI menu that I am turning into a select dropdown when you're viewing it on a mobile. I want to now indent child items e.g List item 1 -- Child item 1 ---- Child Child item 1 -- Child item 2 List item 2 Rather than listing in one single line. I'm happy to just add nbsp to keep things easy - or add classes and CSS if more suitable. The code I am currently using to generate the select is: $("<select />").appendTo("#primary-nav"); $("<option />", { "selected": "selected", "value" : "", "text" : "Go to..." }).appendTo("#primary-nav select"); $("#primary-nav a").each(function() { var el

setting overflow hides li bullets (overflow property conflict with list-style)

北城余情 提交于 2019-12-04 18:17:18
setting overflow and text-overflow property makes the li hide bullets. I've tried putting the bullets "inside" but it still didn't show bullets. Plus I'd prefer to put it "outside" ul.hbox_poplist { list-style: circle url('/img/bpt_clear.png'); } ul.hbox_poplist li { margin: 0 0 8px; max-height:32px; text-overflow: ellipsis; overflow-y: hidden; } does anyone know any solution to this? Using a CSS background is much more dependable across browsers than using list-style-image for custom bullets. Controlling the position of a list-image is quite difficult on its own. Something like: .bullets {

Check/Uncheck Parent/Child Checkboxes using Jquery

橙三吉。 提交于 2019-12-04 16:52:19
I am not really that familiar with jquery or javascript and I need a quick solution to my problem that is why im posting it here. Below is a sample html snippet: <ul> <li><input type="checkbox" />Administration <ul> <li><input type="checkbox" />President <ul> <li><input type="checkbox" />Manager 1 <ul> <li><input type="checkbox" />Assistant Manager 1</li> <li><input type="checkbox" />Assistant Manager 2</li> <li><input type="checkbox" />Assistant Manager 3</li> </ul> </li> <li><input type="checkbox" />Manager 2</li> <li><input type="checkbox" />Manager 3</li> </ul> </li> <li><input type=

list-style-position does not work when list-marker is pseudo-element. Why?

元气小坏坏 提交于 2019-12-04 13:27:38
I wanted to create colored list-markers for <ul> and I did it, but in all lists now the list-style-position attribute does not works. Here is the code: ul.FirmStyle { list-style-type: none; } ul.FirmStyle li:before { color: orange; content: "▪"; list-style-position: outside; /* !!!!!! */ margin-left: 10px; } <ul class="FirmStyle"> <li>A lot of texttttttttttttttttt-t-t-t-tttttttt-tt-tt-tt-ttttt-t-tttttt-t-tttt-tttt</li> <li>Text</li> </ul> Why? As per W3C Specs , the list-style-position property controls the positioning of the marker pseudo element in the list item. list-style-position This

jQuery - How can i dynamically add a list item to an unordered list?

こ雲淡風輕ζ 提交于 2019-12-04 11:47:25
Seems like a simple thing to do (although im still learning the ins and outs of jQuery). Here's my HTML: <div id="fbsignup"> <div class="message messageerror"> <strong>There were errors with your registration:</strong> <ul></ul> </div> </div> Here's my (attempted) jQuery: // Check Required Fields. $('#fbsignup input.required').each(function () { if ($(this).val().trim() == '') { $(this).next('em').html('*').show(); $('#fbsignup .message ul').add('li').html('Fields marked with * are required.'); } }); And this is what it is doing to the DOM: <div class="message messageerror"> <strong>There were

Text Shadows on counter or bullet in list

半城伤御伤魂 提交于 2019-12-04 11:18:57
I want to know how to add text-shadow to an ordered list </ol> . I've tried, the following example but it doesn't work. body { text-shadow: black 0.1em 0.1em 0.2em; color: gray; background: white; } ol { text-shadow: black 0.1em 0.1em 0.2em; } Ordered Lists <ol> <li>content</li> <li>content</li> <li>content</li> </ol> My issue it tahe the list counter doesn't have the text shadow . I need to add text shadow to the number in the ordered list, like the 1. , or 2. , etc. By the way, I want it to still retain like a list style where the content is indented before the number. If you also want to

css list inline is not listing items horizontally?

☆樱花仙子☆ 提交于 2019-12-04 10:16:58
问题 I don't know why this is not displayed right, the list is meant to display horizontally? Instead it is displaying vertically! this is my code: #stats li { display: inline; list-style-type: none; padding-right: 20px; } <ul id="stats"> <li> <h1>53</h1> </a> </li> <li> <h1>67</h1> </a> </li> </ul> 回答1: You forgot to add float: left property to your CSS: #stats li { display: inline; list-style-type: none; padding-right: 20px; float: left; } By the way, you are missing opening a tag in your HTML

onclick event pass <li> id or value

半腔热情 提交于 2019-12-04 10:00:32
问题 I want to pass <li> id or value in onclick event. here is my exiting code. <li onclick="getPaging(this.value)" id="1" value="1">1</li> <li onclick="getPaging(this.value)" id="2" value="2">2</li> here is the javascript code function getPaging(str) { $("#loading-content").load("dataSearch.php?"+str, hideLoader); } 回答1: Try like this... <script> function getPaging(str) { $("#loading-content").load("dataSearch.php?"+str, hideLoader); } </script> <li onclick="getPaging(this.id)" id="1">1</li> <li

CSS list-style-type not working

一世执手 提交于 2019-12-04 09:03:03
问题 I have set the list-style-type in CSS, but for some reason it's not showing it. body { margin: 0; } ol { list-style-type: decimal; padding-left: 0; } <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol> 回答1: Because of your padding reset, the numbers are actually off to the left of the page. Try adding: list-style-position: inside; 回答2: display:list-item; list-style-position:outside; It may give problem if list display: attribute is set to some thing else than display:list-item; 回答3:

CSS : Styling the content of before pseudo element on a list

拜拜、爱过 提交于 2019-12-04 08:39:06
问题 I'm trying to style an ordered list (no dot, a border with radius and rotate 45°) <div class="test"> <ol> <li><span>it's a test</span></li> <li><span>and again</span></li> </ol> </div> And the css .test ol { counter-reset: li; list-style-type: none; } .test ol > li { position:relative; list-style:none; } .test ol > li:before { content:counter(li); counter-increment:li; position:absolute; top:-2px; left:-24px; width:21px; color:#E2202D; font-weight:bold; font-family:"Helvetica Neue", Arial,