Vertical alignment of bootstrap modal on mobiles - html

This question seems to have been asked a number of times on github but I haven't come across any solutions:
https://github.com/twitter/bootstrap/issues/1399
how can the modal be vertically aligned properly on small screens?

Edit: As of Bootstrap 2.0.2, this is no longer an issue. Basically, bootstrap now implements the solution proposed below, which I'll leave here for reference purposes.
Generally, on small screens modals will fill out most of your window, so positioning relative to the button that triggered the modal doesn't make terribly much sense. What I usually do is just overwriting the modal position for phones:
#media (max-width: 767px) {
.modal {
top: 20px;
// negative left margin to position horizontally.
margin: 0 0 0 -280px;
// already in modals.less, just copied for clarification:
left: 50%;
position: fixed;
}
}
(This is in LESS, pure CSS solutions looks similar).

Related

Layouts changing drastically in mobile view

I have This site
It looks okay in normal browser from PC.
But whenever I switch to mobile view from inspect, it looks like this
http://azlily.bex.jp/eccube_1/html/
2: https://i.stack.imgur.com/uSHAe.png
Should I implement Media screen indivisually for all components in website? If Yes, then Why is title and some components are fit in mobile view.
You dont need to implement media screen for every item present. the trick is to make it responsive from the ground up, and then just make small alterations to the layout as it shrinks down if still needed. For example, take this news_area div section. You have it positioned in the center of its parent container - news_contents. But dont use fixed margins to center it, you want add css so that it stays in the center even when it shrinks down.
example:
.news_contents {
width: 100%;
margin: 0;
padding: 0;
}
#news_area {
width: 90%;
background: #d9d9d9;
margin: 30px auto!important;
}
[note:the !important tag is only needed here to override some of your existing css. Also this is just a rough example to show you the layout.]
With this added to your css, the news_area will always be centered in its parent div, and always have space either side. This is what i mean by coding it with a responsive design from the start. This section now doesn't need media screen to alter it again as it works on all device sizes with its original css.

Full-height sidebar

I have the following page with sidebar: https://www.slagerijrudi.be/product/broodje-ham/
I was wondering if there is a simple way to make my sidebar have the same height of the content next to the sidebar. So the sidebar should stretch from header to footer, instead of stopping halfway the page.
In order to allow the aside (or sidebar) to reach its full height, you can make it have an absolute position. Do remember though to turn it off for smaller screen sizes (where you'd want to collapse the sidebar). The best design practice at the moment is to declare specific behaviour for larger screens: #media screen and (min-size:667px) { .. your code for big screens here .. }
Add the following to solve the issue:
.wf-wrap {
position: relative;
}
.sidebar {
position: absolute;
left: 0;
height: 100%;
}
Edit: as a comment on the question put it, a flexbox is a neater solution, but not a 'quick fix'.

Spacing/width issue with my CSS3

I am not sure why there is a spacing (margin/padding) to the left in the second and third tabs. The test site location is: http://new.vonsazkin.com/index.aspx
Click on Residents in top menu and then click on the Events tab or the Records tab. You'll notice that the grid is pushed down. If I set the width of the grid to auto, then it moves up where I want it, but it shrinks. The max width I can set is 66.67% but it is shifted to the right. I want the grid to be 100% width and not have the spacing on top. You can right click in the browser and click the Inspect Element option to view the page code and CSS for the site.
Any clue?
Thanks in advance!
Interesting :) I found where the problem is: style.css
.residents_block .tab-pane {
display: block;
...
This display: block is messing with showing/hiding tabs. With this CSS other tabs are there but have opacity: 0. I believe this is some custom css (which breaks bootstrap functionality) and you should remove it...
All you need to do is absolute position the table when its parent is relatively positioned.
.resident_workspace_form .table-wrapper {
position: relative;
}
.resident_workspace_form table.alt {
position: absolute;
}
The padding between tabs
I didn't really understand what's your problem, but if you have in mind the space between the tabs - you have padding. Also tabs have height at media (max-width: 1199px) and (min-width: 992px) The height of tabs.

Sticky-Footer for jQueryMobile

The best way to describe what I'm looking for is the thread below.
Make div stay at bottom of page's content all the time even when there are scrollbars
The difference is I want a footer like stackoverflow at the bottom but using the jQueryMobile framework. Is this possible?
I've tried the techniques in the other thread successfully for sites not using the framework, but I think the framework forces divs into absolute position and it gets really messy and I'm not sure the best way to do this?
Any help is appreciated.
I found the answer to my question.
[data-role=page] {
min-height: 100%;
position: relative;
}
[data-role=content] {
margin-bottom: 80px; /* based on how tall your footer is and how much gap you want */
}
[data-role=footer] {
position: absolute;
bottom: 0;
width: 100%;
height: 60px /* this can be configurable, or omitted, as long as the above padding-bottom is at least as much as the height of the footer is */
padding-bottom:60px;
}
I did a variation of the answer I found by Nick here: Jquery Mobile Sticky Footer
What I changed was to use margin instead of padding so that the content didn't increase in size when there was no need for it to.

Incorrect scrolling after vertical centering

So I have a problem, after setting position: absolute; top: 50%; margin-top: -310px for my main content. The problem is when I minimalize the browser window and the vertical scroll appears, top part of the layout is hidden.
Here is what I mean: http://jsfiddle.net/95Uzt/15/. You can see the menu and contact form but the header above the form is not visible/covered by the browser. What is wrong?
I think you're trying to handle two cases with one piece of code, and that's just not working. You're going to need to use some kind of conditional code to handle the two cases.
Your two cases are:
For a viewport more than 620 pixels, you need to center the content
For a viewport less than 620 pixels, you need the content top aligned.
For more modern browsers that support it, you could look into using CSS:
#media screen and (max-height: 620px) {
.content
{
top: 0px;
margin-top: 0px;
}
}
If you need more extensive browser support, you'll need to use javascript, I think.