How to set ion-select component with 100% width in IONIC 2 - ionic2

I would like to set my ion-select with 100% of width.
I have tried with css class like this:
.mySelect { width: 100% !important; }
But it is not working.

I did it.
For someone who wants the solution, here is the code:
.myCustomSelect{
max-width: 100% !important;
}
You must have to override the 'max-width' css property.

Increasing the specificity of the selector allows for doing it without the !important on it:
ion-select.myCustomSelect{
width: 100%;
max-width: 100%;
}
Which makes it a bit cleaner, since !important should be used as sparingly as possible, as noted in the Stack Overflow article here:
Should I avoid using !important in CSS?

You don't need !important at all! Ionic has specified a min-width of 45% (or whatever as per your version of ionic). All you have to do is over-ride it with a max-width of 100%. At the same time, the select, being an inline element, will only expand to fit its contents. So it won't fill the whole width. So to make this happen, you simply add width: 100% to it. So your final CSS class may look something like this:
.full-width-select {
width: 100%;
max-width: 100%;
}

I try the each solutions but found a perfect way to do this :)
just modify your sass file by adding this
ion-select{
max-width: 70% !important;// your choice :)
}

The answer from Luis Antonio Pestana is good if you associate it with the code of his initial question. So to be more clear, the complete code to get the ion-select to take 100% of its container is :
.your_ion_select {
max-width: 100% !important;
width: 100% !important;
}

This is what helped me. After perusing multiple articles, I've found in this stack overflow article ~ Styling ion-select with popover interface, that if you open the developer tools and use the inspect tool, you can see the class that directly affects the select option.
So now that we know that the classes are .alert-wrapper.ion-overlay-wrapper.sc-ion-alert-md we can then add adjust this in our global.scss file
Like so
:root{
.alert-wrapper.ion-overlay-wrapper.sc-ion-alert-md{
max-width: 100% !important;
width: 100% !important;
}
I'm currently working with Ionicv4 and above, however I'm assuming this should still be of assistance

Related

Is there a way to configure Prettier so that it doesn't minify inline CSS in .mjml templates?

I'm using .mjml templates and VSCode. I had to install an extension for the highlighting to work correctly but I noticed by Prettier seems to transform inline CSS (which is pretty common in emails) from this:
p,
h1 {
color: #ffffff;
}
h1,
.text-h1 h1 {
font-size: 32px;
line-height: 1.1;
margin: 0 0 16px 0;
font-weight: 700;
}
to this:
p, h1 { color: #ffffff; } h1, .text-h1 h1 { font-size: 32px; line-height: 1.1; margin: 0 0 16px 0; font-weight: 700; }
The only way I was able to prevent this is by adding a <!-- prettier-ignore --> before the <mj-style> tag but I was wondering if there isn't a better way (configuration?) to get the same result without the extra markup.
See:
https://github.com/mjmlio/mjml/issues/2557
Is there a way to tell Prettier that the following "block" has a specific markup type?
Based on my research and also the lack of answers, it looks like the overall MJML tooling ecosystem is not in the best of states. I think for now the best option is to use the workaround I provided. Here is a detailed breakdown of the options available.
Style element <mj-style>: (most likely the best option)
<!-- prettier-ignore -->
<mj-style css-inline="inline" />
.content {
color: green !important;
}
</mj-style>
Pros:
Works in the online visual editor by copy/pasting the markup.
Cons:
No Prettier formatting (ref).
An external CSS file:
<mj-include path="./default.css" type="css" css-inline="inline" />
Pros:
You can import a CSS file that will get normal Prettier treatment.
Standard pattern where CSS lives outside the document.
Cons:
It also won't work with the online MJML editor tool without merging back your CSS file. This is very annoying and makes it hard to maintain.
<mj-include> can report miss flagged error depending on our your project is setup.
It does not work with the "official" VSCode plugin (you have to use this one).
MJML inline styles:
<mj-text color="#fff" padding="0" font-weight="400" font-size="16px" line-height="1.65" />
Pros:
You don't need CSS.
Cons:
You possibly will repeat a lot of the same style and maintenance can become problematic.
Style element <mj-class>:
<mj-class name="blue" color="blue" />
Pros:
Benefits from the re-usability of CSS without having to use CSS, avoiding Prettier issues.
Cons:
Not as flexible as CSS in terms of selectors which can lead to repetition and maintenance issues.

Spritesheet appearing behind Like button

In the below image I am getting a sprites-sheet? that is appearing in the background of my Like button? Any ideas on why this might be? You can see it live at http://MTGPeerTrader.com.
I have tried adding a style to disable this via:
background-image:none !important;
but it was without effect.
Ok I think I have it...
You have inline-style so, the <span style="height: .. px; width: .. px"> just before of the <iframe id="f3b93e80cc".. remove height and in your stylesheet #FaceBookGroupLink put margin-top: 68px;
I hope this help you...

Change the tag-it font size

Does anybody know how to change the size of the fonts appearing in tags of the tag-it plug in? I went over the stylesheet but it does not seam obvious to me how to do it.
It is in the color specifc css file, tagit-stylish-yellow.css for example.
Look for
ul.tagit { cursor: text; font-size: 14px; color: #333; }
and change the font-size.
I found this by going to the demo site in Chrome, start the inspector by pressing F12, selecting the tag and looking at the css directives that affect it.

Why might django messages not have tags?

I'm trying to disable the add/change for certain models, and I'm doing so by overriding the add_view method in the admin object. In so doing, I want to add a message to the user, then redirect. I'm adding the message this way:
messages.add_message(
request,
messages.ERROR,
"Please use the other interface.",
)
after following this:
http://readthedocs.org/docs/django/en/latest/ref/contrib/messages.html
And it works, but it shows up with a little green check mark next to it, as if it were a success. I checked the template, and it adds whatever classes are in message.tags (and if there's warning, or error, you get different icons than the check mark). But when I make a message the way that link above says (or any other way I've found), I don't see tags on the message object.
Any ideas what might be going wrong?
I just had an experience yesterday where I encountered the exact same thing. What solved it for me, believe it or not, was restarting the web service. I was working locally with ./manage.py runserver so not sure whether that was your scenario or not.
Incidentally, I have found other bizarre django oddities, particularly when creating a lot of new code, solved by doing this.
Make sure that in settings.py, the MIDDLEWARE_CLASSES list contains
'django.contrib.messages.middleware.MessageMiddleware',
Otherwise, Django messages sort of work, but only for authenticated users, with broken message tags, and possibly other problems.
(I just ran into the same problem, and adding that line fixed it.)
This is what is in my django admin base.css:
ul.messagelist li {
font-size: 12px;
display: block;
padding: 4px 5px 4px 25px;
margin: 0 0 3px 0;
border-bottom: 1px solid #ddd;
color: #666;
background: #ffc url(../img/admin/icon_success.gif) 5px .3em no-repeat;
}
Which means despite it's class or tags, it gets the icon. Just has to be a message <li> in the messagelist.

Word wrap in PISA PDF

I have a Django view that renders a piece of text and word wraps it. I am using the below CSS. When I convert the same to PDF using PISA, I dont see the word wrap and text is lost.
Do I need to set any properties on PISA for this?
{
margin-left: 20px;
padding: 0;
font-size: 12;
font-family: "Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;
color: #333;
word-wrap: break-word;
}
Keep in mind that Pisa does not use CSS itself, it just implemented some of the CSS syntax and properties to apply its own rules in PDF generation.
See the section 6, Cascading Style Sheets, of the manual for the supported properties. And take a look at this nice manual, that is a little bit more detailed.
It's hard to find good documentation about pisa.