ionic - list is slightly bigger than container - css

I'm working on an ionic app.
I've just noticed that the list I'm using, is slightly bigger than it's container.
At first, I though it was related to the border, but it is not.
I know that it's not a deal breaker, but it does look odd to me, and i'd like this list to look nice and contained by the container without exit (even if it's only a couple of pixels)
You can see an example here: http://codepen.io/NickHG/pen/VaogjL
If you look closer, you can see that everything beneath connection setting list divider is outside.
The code i'm using is a simple list from ionic docs:
<div class="hg-login-card-advanced-connection-settings">
<div class="list">
<div class="item item-divider">Connection Settings</div>
<div ng-repeat="conn in connections">
<item class="item item-toggle">
{{conn.name}}
<label class="toggle toggle-primary">
<input type="checkbox" ng-checked="{{conn.checked}}" ng-model="conn.checked">
<div class="track">
<div class="handle"></div>
</div>
</label>
</item>
<item class="item hg-login-card-advanced-connection-settings-details" ng-show="conn.checked==true">
<input type="text" placeholder="testing">
<small class="hg-login-card-advanced-connection-settings-details-status">Status</small>
</item>
</div>
</div>
</div>
</div>
How can I fix this? Thanks for any feedback and suggestion

Your .item has a minus margin which leads to your problem. Replacing the css with this fixes the problem:
.item {
margin: 0;
}
I don't know why this would be happening though. It's the ionic basic css. I guess it's their way of dealing or should I say hiding the left and right border of an item.

Related

Z-index doesn't works in Internet Explorer 11

I've a problem with the z-index on IE 11, a dropdown appears under other element in a pop up message. Let me show you a little sketch captured from the page.
Pop-up sample
I reasearch for a lot of possibles solutions but any doesn't works for me. Also I am using PrimeFaces with Angular 2. I found this solution to fix this kind of problem in IE:
<div style="position: relative; z-index: 3000">
<div style="position: absolute; z-index: 1000">
[ ... ] <!-- The drop down menu will be here -->
</div>
</div>
And I tried to use this way with my code, but doesn't work. :(
<p-dialog header="Assign claim {{ vm.request.id }}" [(visible)]="vm.isDisplayed" [width]="700" [modal]="true" >
<div class="ui-g form-group">
<div style="z-index: 3000">
<div class="ui-g-6">
<h4>Lorem ipsum</h4>
{{vm.request.responsible}}
</div>
<div class="ui-g-6">
<h4>et dolo</h4>
<div style="z-index: 1000"> <!-- This dropdown menu should to appear over the form, not behind :( -->
<p-dropdown class="popup-dropdown" [(ngModel)]="vm.id" [options]="vm.users" [autoWidth]="false" (onChange)="changeAssignedUserId($event.value)">
</p-dropdown>
</div>
</div>
<div class="ui-g ui-g-12"></div>
</div>
</div>
<!-- More awesome code! -->
Can anybody help me?
Thanks in advance to everybody.
Ashia.
Because sadly, you cannot redefine z-index for a child component with a parent who already has z-index defined. The child inherit the z-index from it parent when it exist.
You can use the z-index: -1; hack, but it's not really a stable and advisable solution...
The best approach is to define z-index for your “brother” component (both .ui-g-6 for example).
Thanks to everybody, specially to #MadDev, finally I solved the problem following your answer, I used the following code
<p-dialog [contentStyle]="{'overflow':'visible'}">
<p-dropdown appendTo="body"></p-dropdown>
</p-dialog>
Ashia.
I think that your problem comes from PrimeNG. Note that you are using a p-dialog, with a p-dropdown component inside, such the PrimeNG documentation explains:
Overlays Inside
When dialog includes other components with overlays such as dropdown, the
overlay part cannot exceed dialog boundaries due to overflow. In order to
solve this, you can either append the overlay to the body or allow overflow
in dialog.
<p-dialog>
<p-dropdown appendTo="body"></p-dropdown>
</p-dialog>
<p-dialog [contentStyle]="{'overflow':'visible'}">
<p-dropdown></p-dropdown>
</p-dialog>
Then your code should be:
<p-dialog header="Assign claim {{ vm.request.id }}"
[(visible)]="vm.isDisplayed" [width]="700" [modal]="true"
[contentStyle]="{'overflow':'visible'}>
<div class="ui-g form-group">
<div style="z-index: 3000">
<div class="ui-g-6">
<h4>Lorem ipsum</h4>
{{vm.request.responsible}}
</div>
<div class="ui-g-6">
<h4>et dolo</h4>
<div style="z-index: 1000">
<p-dropdown class="popup-dropdown" appendTo="body"
[(ngModel)]="vm.id" [options]="vm.users" [autoWidth]="false"
(onChange)="changeAssignedUserId($event.value)">
</p-dropdown>
</div>
</div>
<div class="ui-g ui-g-12"></div>
</div>
</div>
This should fix your problem.
;-)

align img, span, and div with bottom border

I have an image, single character in a span (equal sign), and then a div where child elements are added/replaced via js.
However, I can't for the life of me figure out how to get it all aligned properly (fear I'm over thinking and complicating it.)
I'm using bootstrap's grid (row/col) system as well.
Something akin to...
<div class="container">
<div class="row">
<div class="col-lg-2 col-offset-lg-1">
<div class="response-part">
<img src="foo" />
<span class="opensans">=</span>
<div id="rp1" class="opensans inline" style="width: 50px;">
</div>
</div>
</div>
<div class="col-lg-2">
<div class="response-part">
<img src="foo" />
<span class="opensans">=</span>
<div id="rp2" class="opensans inline" style="width: 50px;">
<span class="opensans">X</span>
</div>
</div>
</div>
</div>
</div>
See jsfiddle
Wanting image centered middle along equal sign (vertical-align) as well as span within neighboring div (and the text in that span appearing just a few pixels off the bottom line.)
I saw this but none of the solutions are addressing the problem for me (I can only guess it is because of the third element and font, etc.)
UPDATE1: Edited sample html to correctly reflect the scenario in which the response-part.div is empty (initial state, possible transition state as user interacts with the page.) Updated fiddle
UPDATE2: I "fixed" the issue occurring with no child elements by adding an initial element in the initial html for the response-part, and then adding one back in when the user removes all other elements. A bit hackish, would appreciate a fix that didn't involve this workaround if possible. Updated fiddle
PS: I initially considered using bootstrap v4 (with flexbox support) but it is still alpha. Alternatively, I also looked into using FlexboxGrid, however I still need bootstrap for other features and FlexboxGrid uses similar classes ("row", etc) as bootstrap, which I assumed would cause name conflicts (if I included both in my project, eg: which "row" class would be used!)
Try using display: flex; on your response-part class. Something like this:
.response-part {
display: flex;
align-items: center;
}
I edited your fiddle. Take a look on it: https://jsfiddle.net/gusLnyyh/6/

How do I change the position of an html input using CSS

I'm new to this, so I apologice if the questions are stupid.
I have some code I inherited that I need to customize. I have an input defined in my html file:
<div style="display: none;">
<input id="homeIcon" type="hidden" value="true" />
I also have this in my html:
<div id="header">
<div style="float: left;">
<div id="headerTitle">
My Website
</div>
</div>
</div>
In the CSS I want to decide where to place this home icon. I want it to appear in the header to the right of the headerTitle.
Can I use the CSS to move an html element so that it appears in another div?
I managed to change the location within the current div - but not move it to an entirely new place.
Thanks,
Rocky
It's bad idea to relocate elements using CSS (absolute positioning and other stuff that will break your layout).
CSS is just for visual representation of elements, so use HTML to change elements position
<div id="header">
<input id="homeIcon" type="hidden" value="true"/>
<div id="headerTitle">
My Website
</div>
</div>
hello Rocky using css you can not move the element to another div but you can "over lap on the div area" so look like you put them to another div.using position

Need consistent Bootstrap form inputs across browsers

I have a grid of input fields on my form. Bootstrap is naturally adding a bit of horizontal space between the fields in Firefox, which is how I want the form to look, but the fields are getting jammed together in Chrome. In the Firefox image above, I have highlighted the col-md-2 div in Firebug which wraps the input field. The input field is highlighted in Chrome.
This seems to be the difference - Firefox seems to be constraining the input fields to fit inside the grid elements, but this is not the case in Chrome. In Firefox, the input fields in the grid are 144 px wide but in Chrome they are 170 px wide.
Here is the markup for a row of fields:
<div class="row signup">
<div class="col-md-1">
<span class="plus-icon">
<img width="18" height="18" src="/assets/plus.jpg" alt="Plus">
</span>
<span class="minus-icon">
<img width="18" height="18" src="/assets/minus.jpg" alt="Minus">
</span>
</div>
<div class="col-md-2">
<input id="sheet_slots_attributes_0_label" type="text" name="sheet[slots_attributes][0][label]" value="Food">
</div>
<div class="col-md-2">
<input id="sheet_slots_attributes_0_name" type="text" name="sheet[slots_attributes][0][name]" value="Foo">
</div>
<div class="col-md-2">
<input id="sheet_slots_attributes_0_email" type="text" name="sheet[slots_attributes][0][email]" value="foo#foo.com">
</div>
<div class="col-md-2">
<input id="sheet_slots_attributes_0_phone" type="text" name="sheet[slots_attributes][0][phone]" value="">
</div>
<div class="col-md-2">
<input id="sheet_slots_attributes_0_comments" type="text" name="sheet[slots_attributes][0][comments]" value="">
</div>
</div>
I have tried to build a fiddle to demonstrate this but I am not able to get it working. So sorry for no fiddle, but I thought someone may have seen this before.
FYI the row signup markup is just adding bottom margin to space out the rows a bit. Also, I've tried adding an extra col-md-1 to get to an even 12 both at the start and end of each row but it doesn't help. I don't have any extra markup for any of this - just using Bootstrap.
It would be great to also understand why the input boxes look relatively ugly (squarish and plain) on Chrome as well - perhaps this is related.
You need to set the width of the inputs to 100%. This makes them take up the width of their container. Otherwise, you are letting the browser determine the default width of the inputs. You can do this manually, or add the bootstrap class form-control to each input.
See it in action in this demo bootply

How to reproduce the following effect in CSS, stuck at padding(I think) Bootstrap 3.0

I've tried everything I can think of and I cannot reproduce this form in this way:
I want to make it to look exactly like in the picture but I have the following problems:
The buttons and the last text input are not staying inline.No ideea how to fix this and possibly resize the other ones so they look like in the picture.
I cannot use specific fonts already imported into html(I've tried adding them in css with the !important function, still doesen't work)
Problems with the button color.
I really have no more ideeas left.I am very new to all this.
Can someone help me make the modifications necessary to reproduce the form in the picture?
Here is what I have now:
http://www.bootply.com/x59KVak
Wrap the two elements in a div and float them left and right: BOOTPLY
<div>
<input style="float:left">
<button style="float:right"></button>
</div>
Just add div parent for input and button and make float left,right...here is fixed, if i understand good.
http://www.bootply.com/TGuWOd5ZET
User this for your last line button and text, tested it and found working
<div class="form-group row">
<div class="col-lg-12">
<label for="Camera2">Camera dorita</label>
</div>
<div class="col-lg-6">
<input class="form-control" id="camera" type="text">
</div>
<div class="col-lg-6">
<button type="submit" class="btn btn-warning">Cauta</button>
</div>
</div>

Resources