Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unordered lists show up without any styling #2582

Closed
Aditya94A opened this issue Jan 2, 2016 · 36 comments
Closed

Unordered lists show up without any styling #2582

Aditya94A opened this issue Jan 2, 2016 · 36 comments

Comments

@Aditya94A
Copy link

The following means that by default all unordered lists appear without styling:

ul {
  list-style-type: none; }

Perhaps this property should have a narrower focus?

@lebart
Copy link

lebart commented Jan 13, 2016

+1

@keeferrourke
Copy link

+1 unordered lists with bullet markers are an important part of a lot of information displays; obviously this exists so navbars, etc. don't have bullets, but a narrower focus would be a really great improvement.

@acburst
Copy link
Collaborator

acburst commented May 17, 2016

You can add the browser-default class or enable it in your own css.

http://materializecss.com/helpers.html#browser-default

@acburst acburst closed this as completed May 17, 2016
@sfcgeorge
Copy link
Contributor

Probably shouldn't be closed, this doesn't actually work. The browser-default class only resets the list style type on the ul but it was disabled at higher specificity on the ul li. It is nuts that a framework would disable styling of lists, it really should be a part of the typography page.

/* Materialize overly specific disable */
ul li {
  list-style-type: none;
}

/* not specific enough to put default back */
ul.browser-default {
  list-style-type: initial;
}

If you're set on keeping the nuts default, the browser-default class could be fixed thusly:

ul.browser-default li {
  list-style-type: initial;
}

@phu
Copy link

phu commented May 24, 2016

Thanks for that, @sfcgeorge. It'll definitely be helpful.

@silverdr
Copy link

silverdr commented Sep 6, 2016

So - if I may ask - what is the preferred way of getting properly nesting, bulleted lists?

.browser-default brings the zero level bullets back but no nesting

@phu
Copy link

phu commented Sep 6, 2016

@silverdr: It's my impression there isn't one; it seems not to be a concern here. I ended up with this in a custom CSS file; it's pretty arbitrary, but it gets the job done, and should at least show one way to improve the non-workaround provided.

ul.browser-default {
  padding-left: 30px;
  margin-top: 10px;
  margin-bottom: 15px;
}
ul.browser-default li {
  list-style-type: initial;
}

It enables bullets and nesting, but only when browser-default is applied to all ul's, which may be obvious but I thought worth mentioning. Note that since this explicitly specifies the list-style-type, it doesn't give the default different-styles-at-nested-layers discs, which might be possible but wasn't a priority for me.

@acburst
Copy link
Collaborator

acburst commented Sep 7, 2016

Fixed in 7906874

@silverdr
Copy link

silverdr commented Sep 7, 2016

@acburst yes - that seems like a better way to handle the issue.

@invious
Copy link

invious commented Dec 10, 2016

This isn't fixed in 0.97.8. I had to add this CSS to ovverride it:

ul:not(.browser-default) {
	padding-left: 30px;
	margin-top: 10px;
	margin-bottom: 15px;
}

ul:not(.browser-default) li {
    list-style-type: disc;
}

and nested lists still don't work! How do I get good old nested lists to work?

@wiretail
Copy link

wiretail commented Dec 19, 2016

It's working fine for me in v0.97.8. Are you doing this?

<ul class="browser-default">
    <li>test</li>
    <li>test</li>
    <ul class="browser-default">
        <li>test</li>
    </ul>
</ul>

That is without any other css, just materialize -- should look like a normal list.

@wiretail
Copy link

wiretail commented Feb 1, 2017 via email

@retorquere
Copy link

Yep, that did it. Good enough for me, I don't see anything I can't live with and plenty I wouldn't want to do without 👍

@JayHoltslander
Copy link

JayHoltslander commented Jun 16, 2017

Currently creating a Wordpress theme utilizing Materialize and discovered this .browser-default issue while editing content and trying to put in a <ul>. Quite inconvenient if someone who just wants to write content suddenly has to edit the code to add classes to the list.

I'm going to have to disable this.

Would be far better to have a <ul class="unstyled"> than breaking all existing content lists.

@JayHoltslander
Copy link

My Wordpress fix for this was:

SCSS

section[id*="post-"] .card {
	ul {list-style-type: initial; padding-left: 30px; margin-top: 10px; margin-bottom: 15px;}
	li {list-style-type: initial;}
}

The selector allows for the <ul> to remain unstyled everywhere else but when a list appears in my theme's content area within <section id="post-1234"><div class="card"> ... </div></section> it get's normal list styling.

@keeferrourke
Copy link

Is there a good reason that ul styling is globally stripped at all? The browser-default classes seems like a bad solution when the bullets could only be stripped from elements that should not display them (such as navbars, tabs, etc.)

@jtebert
Copy link

jtebert commented Sep 7, 2017

^ I'm with this guy. The default behavior of lists being no bullets and no indentation doesn't make any sense from a content perspective. Adding the option to specify the browser-default class is also an inelegant solution. For example, lists generated by Markdown (my current use case) must be somehow hackily edited in order to display list a normal list.

@tomscholz tomscholz reopened this Sep 7, 2017
@tomscholz
Copy link
Contributor

Whoops, closing again. See this comment for information regrading this topic #5004 (comment)

@phu
Copy link

phu commented Sep 7, 2017

Maybe I'm missing something, but I don't see anything relevant in that thread.

@tomscholz
Copy link
Contributor

See this comment #5004 (comment)
We will move away from styling native elements and .browser-default. I understand, that it is really frustrating, but it is currently very unlikely that this will ship with v1. If you want, you can create a PR, which fixes this. In this case I would make the PR against the v1-dev branch...

@mrdnote
Copy link

mrdnote commented Nov 8, 2017

Tom, great product, but indeed please remove browser-default asap. We have a site where users can add their own content thru an in-page html editor, we cant expect end user to add "browser-default" classes to their lists right?

Any idea when this will be included in a release?

@firanto
Copy link

firanto commented Mar 9, 2018

Now I realize that this approach is somehow .... weird. I mean, why do we have to define .browser-default to revert back? I just add CKEditor and found that when user editing anything within the editor, unordered list will not have bullets (and not indented too).

@JayHoltslander
Copy link

Almost a year later and here I am again looking for the fix that I did last time. (Sigh)
So frustrating.

@Dogfalo
Copy link
Owner

Dogfalo commented Mar 20, 2018

@JayHoltslander We'll be fixing this after 1.0 release. We understand this can be a frustrating problem.

@ray007
Copy link
Contributor

ray007 commented Mar 20, 2018

Isn't it harder to fix after 1.0 since it would be a breaking change?
Just restyling all ul elements is just bad style, that's what classes are for.

@JayHoltslander
Copy link

For others... my fix this time.

HTML

<div class="card-content browser-default-uls">
  ...
</div>

SCSS

.browser-default-uls {
  ul {
    padding-left: 30px;
    margin-top: 10px;
    margin-bottom: 15px;
    li {
      list-style-type: disc!important;
      ul {
        li {list-style-type: circle!important;}
      }
    }
  }
}

@jvillemare
Copy link

For those looking for a simple fix, I just use:

<ul class="browser-default">
   <li>...</li>
   ...
</ul>

@ray007
Copy link
Contributor

ray007 commented Jun 4, 2018

I still think overriding all lists and requiring the user to add browser-default is evil.

@firanto
Copy link

firanto commented Jun 4, 2018

I can't override the third party library I used. So adding browser-default is not an option.

@JayHoltslander
Copy link

@JayHoltslander We'll be fixing this after 1.0 release. We understand this can be a frustrating problem.

Was looking for this one in the Feature Request Board and didn't see it.

@jvillemare
Copy link

@JayHoltslander We'll be fixing this after 1.0 release. We understand this can be a frustrating problem.

Was looking for this one in the Feature Request Board and didn't see it.

Only collaborators of this repo can add it there. @acburst, may we please get one last quick look at this issue? Still seems to be a problem for some devs.

khinshankhan added a commit to khinshankhan/kkhan01.github.io that referenced this issue Apr 4, 2019
khinshankhan added a commit to khinshankhan/kkhan01.github.io that referenced this issue Apr 4, 2019
@ricoms
Copy link

ricoms commented Jun 25, 2020

I rather have the default behavior with the default use. I believe Materialize choice on changing the expected behavior of a common and important text structure is basically wrong.

Explaining my case, I've built a GitHub page in which many people will need to input content. Most of them using simple Markdown syntax. As they understand basics Markdown and many of them use unordered list, which is an important text structure, I would not require or teach them all (or teach them all) on how to use HTML, define style or class of any type to its unordered list.

What I did is to change materialize.css and materialize.min.css from :not(.browser-default) to .materialize. The result is below:

ul.materialize {
  padding-left: 0;
  list-style-type: none;
}

ul.materialize > li {
  list-style-type: none;
}

This way, the navbar, which I implement, will use materialize class. And this leaves the default behavior when my content creators want to use markdown unordered lists.

ricoms added a commit to multimediaeval/multimediaeval.github.io that referenced this issue Jun 25, 2020
@nateleavitt
Copy link

I'm currently having an issue with this. Our customers also provide content through a wysiwyg editor and their lists are not styled. I agree with the general sentiment to not override default ul and li elements.

@DivyanshSareen
Copy link

<ol style="list-style: disc;"> works for me

@DanFeather
Copy link

I have found so many good reasons to use Materialize, but I'm really stumped as to why the release version (1.0.0) still breaks the unordered list's natural style, requiring a workaround to restore the expected formatting. I know there are reasons to use a set of items as something that doesn't look like a list, but a list should, by default, look like a list. Those cases where it's desirable to take on a different look are special cases, and that's what classes (or targeted CSS rules) are for. And as I read back through years of comments, complaints, and workarounds about this issue, I find the promise that "this will be fixed in the 1.0 release." But it's not. What gives?

@argenos
Copy link

argenos commented Feb 16, 2024

I'm not sure why this is closed, since the issue is still present. I cannot add browser-default to lists since I am using jekyll. Is there an open issue for v1.0.0 tracking this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests