Responsive design: How to adjust number of columns? [closed] - html

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My client wants to have a screen that, on a sufficiently high resolution monitor, lays out like this:
First name [textbox1a] Translation [textbox1b]
Last name [textbox2a] [textbox2b]
Street [textbox3a] [textbox3b]
Etc. (The screen shows information in 2 languages, but we needn't get into the details of what that's all about for purposes of this question.)
When the screen is too narrow for this to fit -- say on a tablet -- they want this to change to:
First name Translation
[textbox1a] [textbox1b]
Last name
[textbox2a] [textbox2b]
Street
[textbox3a] [textbox3b]
And on a very narrow screen -- say a cell phone:
First name
[textbox1a]
Translation
[textbox1b]
Last name
[textbox2a]
[textbox2b]
Street
[textbox3a]
[textbox3b]
I really don't want to make the labels fixed width because that would prevent a user from resizing the text. With variable width, I can't make everything float:left because then the columns don't line up. I'm tinkering with using display:table-cell et al but this gets tricky because what goes in each row changes. I think I can make that work if I use #media to switch from 4 column to 2 to 1 but that assumes I know the exact number of pixels when to switch layouts, which I don't without making assumptions about the width of the labels.
Any ideas how to do this?

So, the solution I came up with is to check and see which column is the widest. Then apply that width to every column while making the columns 'float'. That way they always line up.
var maxWidth = 0;
$('.box').each(function() {
var width2 = $(this).width();
if(width2 > maxWidth){
maxWidth = width2;
}
});
$('.box').css("width", maxWidth);
Here is a full JSFiddle for you, you can edit the contents of the boxes to change the size of them to test it out.
http://jsfiddle.net/na50mxtj/

Related

Changing the column labels color based on width of chart [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have created a bar chart that has the values of each of the columns at the end of each bar. The color of the bars is the same as the text of the values. The problem is that based on the width of the container/browser by default the values move inside the bar. But then you can't read the text as the bar and text are the same. I would prefer to have the values outside the bar but when they have to move inside the bar due to space is there a way to change the font color to white so that it is readable? Here is an example of the chart.
https://playground.anychart.com/DAlu15WO/2
Unfortunately, there's no possibility to detect if the label was moved inside the bar or not. But you can enable label background to increase its readability like in the sample.
Pay attention to lines 96-97.
All available background settings you can find in the list.

Hot to center those 3 divs into the body [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
Im wondering how to center those 3 divs into he body, i created 2 versions of the row, one with an extra outer wrap around the column and one without, Unfortuinatly since this html created with a page builder (WP visual composer) so i dont have 100% freedom to control the html structure. I tried margin: auto but couldn't make it to work.
You can find the divs im talking about on this page.
https://bonmedico.de/test/
Thanks
This question will be closed very soon because it's not according to SO rules. ( Read comments to your question to find about that ). You really should put more effort when writing questions.
But i took a look at your website. You can solve your problem in 2 ( maybe more ) ways.
add justify-content:center to the parent row of those 3 columns. Being a display: flex element it will center them horizontally.
using visual composer is easy. Just add 2 small columns ( empty ) left and right and a larger column in the middle. Something like 1/4 1/2 1/4. And in that ' bigger ' column you can add a new row continaing 3 columns ( like you have now ). Or there are more possibilities to do this. Just ' play ' around with visual composer

Remove padding from text input [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Is it possible to change the inner padding of text field? Currently when you take a normal text field in html and write something in there it'll have padding in the beginning and in the end of it. The numbers written in my text field have at most 3 digits and currently the padding pretty much covers the width of 1.5 to 2 digits and already with 2 digits (see number 10 on image) it'll get a bit dragged out.
Added image of it as well, in the first field the padded area is marked with red line.
I dont have code but
.my_input_class{
padding:0;
}
Or, really, the size of the text box needs to be a bit larger, or you put a character limit on it

Bootstrap span, row, column elements need to line them up

I'm new here and to Bootstrap so apologies for any stupidity.
In Bootstrap I'm trying to display .span4 in a row over 2 columns, this is because of page width, which should eventually nest into each other and leave no space. However with all I have tried at the moment I can still only manage to get each .span4 to lineup with the bottom-line of the longest span4 I have created. The site will eventually be dynamic and the size of the list could change frequently.
Looked at many different questions on here but no joy yet.
I have an example of my tryings here http://jsfiddle.net/joebarr/YJunh/
I think you're looking for jQuery Masonry. See for example: How can I float elements with different size in a tile or How to Create Grid/Tile View with CSS?
In case it must be CSS only, the accepted answer for the first link above ( https://stackoverflow.com/a/15320187/1449799 ) shows a good approximation.

How can I make the column widths of a list box in MS-Access2007 automatically size themselves correctly?

Background info:
I was handed a "Tool", which was made using MS-Access 2007, and asked to add some things... The tool is basically a collection of options for querying a database. On a form titled CreatedReport there is a listbox that is bound to a table called analyzed which has all of resulting data from the query/queries that ran. The original creator of this tool set the column widths to specific values but with the new collection of possible results, those widths are very far off.
Desired Outcome:
The final result I want to achieve is, of course, to have the columns be the correct widths for the info that is in the columns. As long as that is achieved, I really don't care which route I have to take to get there.
Question:
How can I get the columns in a listbox in MS-Access 2007 to be sized appropriately for each use? Is there an auto-size feature I haven't stumbled across yet or do I need to hard code the set of column widths for each group? This wouldn't be too hard to do since there would only be about 4 or 5 different groups but I would prefer for the process to be automatic if at all possible.
Another approach would be to have the results returned in a sub form datasheet view, then the user can adjust the column widths also to set the widths automatically use code like this:
Example
This example takes effect in Datasheet view of the open Customers form. It sets the column to fit the size of the visible text.
Forms![Customers]![Address].ColumnWidth = -2
You could put this code into the Current Event of the sub form.
I don't think that Robert Harvey's answer is actually responsive to your question.
What you need to do is:
calculate the maximum length of the values in each column,
AND
figure out, based on the font in use, how wide the column should be.
Note that you may not actually want to set it to the maximum width if the value exceeds a certain threshold.
I don't know to do the second taks, but I suspect Stephen Lebans has already done the work on it. You might want to search his website for it.
Last time I checked, you still had to write code for this.
Your best bet is to use a resizer someone has already written. Here is a good one. It's old, but it shoul still work:
http://www.jamiessoftware.tk/resizeform/rf_jump.html
This is a quick solution that should help when you want to set up listview columns of different widths, and you know in advance the widths you want (eg, you know that column X will always be a 2-character State abbreviation, and column Y will always be a city name).
Just supply all the widths as a single semi colon-delimited string. Code each width as a number and a unit, such as 'in' or 'cm'. This worked well for me: Me.lsvPayHist.ColumnWidths = "1.0 in;0.8 in;1.0 in;1.0 in;2.0 in"