CSS Columns works with all browsers except Firefox - css

I can't seem to get Firefox to cooperate with my 3 columns. It works with all the other browsers. Please have a look at http://www.usslittlerock.org/Marines_Workpage.html. I stripped everything off the page except the relevant CSS and HTML. I've worked with columns before with no problems but this time I used tables in the mix. The look of the layout needs to remain the same. I would actually prefer to eliminate the TABLES but I don't know how to keep the layout style with CSS alone. I've tried a number of different solutions from this site but none work. Thanks for any suggestions you can give.

http://caniuse.com/#search=column-gap reports, under known issues:
Firefox does not split tables into columns
Sorry.
Good new, you can keep you code mostly intact, but replace everything with div's. (this is the easiest way for me to explain it):
With your favorite editor do some simple text replace:
<table> --> <div class="table">
<th> --> <div class="th">
<tr> --> <div class="tr">
<td> --> <div class="td">
<tbody> --> <div class="tbody">
... and the equivalent </table> --> </div>, etc.
Change your CSS:
.marines table --> .marines div.table
.marines table th --> .marines div.th
.marines table td --> .marines div.td
Add a few new bits to your existing css:
.marines div.td {
....
display: inline-block;
width: 52%;
}
.marines div.th {
....
display: inline-block;
width: 52%;
}
.marines div.td:nth-of-type(2) {
width: 20%;
}
.marines div.td:nth-of-type(3) {
width: 25%;
}
and it will work in all browsers (This isn't a complete answer -- you'll still need to handle the Bold text in the headings and the index-Letters, but I think you get the idea.)

Related

CSS media query print:

Doing a page, html result like:
<div class="container table-page">
<div class="selected-block"> some info here </div>
<h1>Table header</h1>
<div class="notice-calc print-shown">Notices !</div>
<table class="input-data">...</table>
<button class="js-btn-add-row">Add row to a input table</button>
<button class="js-calculate">Calculate table values</button>
<div class="js-waiting" style="display: none;">Progress bar</div>
<table class="calc-result" style="display:none;">...</table>
</div>
Main idea of styles below - hide every direct children of '.container' except tables and some table elements with class="print-hidden" will be hidden too. For print version of page using rule:
#media print {
.container> :not(table),
.print-hidden {
display: none;
}
.print-shown {
display: block;
}
}
Later added notices must be shown at print version too, but it does not appear. Nevertheless if edit '.print-shown' rule like:
.container .print-shown {
display: block;
}
Then it shows. Tested in Chrome 88.0.4324.190 (Official Build) (64-bit)/ Dev.Firefox 86.0b9 (64x)/ Opera 74.0.3911.107. And Edge shows it in both cases.
Why single class selector does not work here?
It is because of this selector:
.container > :not(table)
It targets all direct children of .container (which is not a table). This also includes children with the .print-shown-class.
So, when you have a .print-shown element as a child of .container, the .container > :not(table) has presedence over the .print-shown class (because the first selector is more specific than the latter)

emulate two column table inside div in pure css

so basically this is my layout. 3 row div (header content and footer)
what i want to do is emulate inside the content div a table format so i can display info as such
picture1 detail1
picture2 detail2
picture3 detail3
there are at least 10 rows of such info. doesn't have to be picture but can also be text
picture div will be about 150px while detail will be the rest. for the sake of example lets say 600px wrapper
i tried a few setups but it didn't come out the way i desired. in a table this would be a cinch but i would like a pure css table-less layout
something i tried but doesn't come out into columns
HTML
picture
item 1 goes here
picture2
item2 goes here
CSS
.itemwrapper{width:600px;}
picture{width:150px;float:left;}
item{width:450px;float:left;}
.clear {clear:both;}
please tell me how i can do this. jsfiddle example here - http://jsfiddle.net/4qvz220b/1/
table would be as simple as
<table width="500">
<tr>
<td width="150">picture1</td>
<td width="450">item1 goes here</td>
</tr>
<tr>
<td>
<td width="150">picture2</td>
<td width="450">item2 goes here</td>
</tr>
</table>
can someone point me in the right direction, i don't know much about css except what i can do through trial and error. the solution must be cross browser compatible css with no js or hacks etc.
please note that this is not to layout the entire page but just a two column content inside another div. if a unordered list can be used instead somehow, please let me know.
You almost got the structure right. You just need to use the right properties...
With css you can build the actual table structure using the display properties, as you have:
display: table
display: table-row
display: table-cell
And other, such as header and footer, if you use the right syntax.
So a basic example (without any style customization) would be something like:
FIDDLE LINK
<div class="mainwrapper">
<div class="itemwrapper">
<div class="picture">picture</div>
<div class="item">item 1 goes here</div>
</div>
<div class="itemwrapper">
<div class="picture">picture2</div>
<div class="item">item2 goes here</div>
</div>
</div>
css:
.mainwrapper {
display: table;
}
.itemwrapper {
display: table-row;
}
.picture, .item {
display: table-cell;
}

Center Section Not Fitting in 3-Column Responsive CSS Layout

I have a 3-column layout that works pretty well:
http://jsfiddle.net/nicorellius/YNyHW/7/
My goal is to add a pre-existing modular unit into the center div, the one with class two-inner. The markup is like so:
<html>
<head></head>
<body>
<div>
<div class="container">
<div class="one">
<div class="one-inner"></div>
</div>
<div class="two">
<div class="two-inner"></div>
</div>
<div class="three">
<div class="three-inner"></div>
</div>
</div>
</div>
</body>
</html>
The CSS can be seen in the fiddle. Part of the modular unit is actually built from some PHP where some data from a database is fetched and displayed. I have some arrays that I'm using for testing that mimic 6 entries and gives the modular unit a 2-wide by 3-tall box layout. My problem is that when I add this unit into the layout above, I get something like the test site below.
The markup for the modular unit is like so:
<section class="unit">
<section class="buttons margin-top-2em">
<div class="button-fixed-width">
<button type="button" class="<bootstrap-button>">button 1</button>
</div>
<div class="button-fixed-width">
<button type="button" class="<bootstrap-button>">button 2</button>
</div>
<div class="button-fixed-width">
<button type="button" class="<bootstrap-button>">button 3</button>
</div>
</section>
<div class="row">
<?php // loop through some arrays to get module unit ?>
</div>
</section>
I've tried various tweaks to try and get it up but the only thing that does it is making the heights of the outer classes one, two, and three close to zero.
Although I've tried changing heights and other bits to get it to fit, I'm still having trouble figuring out why that center div won't go up. What am I missing?
The CSS for the unit class is in the fiddle. On it's own, it works OK, and I have some breakpoints that collapse it down into a single column. I just cant get passed this part...
EDIT
After trying some ideas from #kozlovski5, I am able to get the divmoving up and down as I need. But there is something going on that is making me uneasy. I'm not too familiar with the display: table, display: table-cell layout so Im sure I'm missing something. For example, when I add text to the divs in question, either the classes one, two, or three, or the inner classes, the adjustments recommended by #kozlovski5 go away. So in other words if I don't use top: -37.5em; and just fill the divs with text, everything seems to work as it should. It's when I try to model the layout with bordered sections that I get the strange behavior.
I ended up going with floats instead. See test site above for final.
I applied:
div > .modular {
display: block;
}
This seems to solve the problem. Here is an updated jsFiddle. http://jsfiddle.net/YNyHW/4/
OP has provided a test case for his website, so my updated answer is:
.two-inner {
background-color: #cba;
border: 1px solid gray;
display: block;
width: 100%;
height: 100%;
position: relative;
top: -596px;
left: 0;
}
Ugghhh.. Another Edit
I think the whole display: table and div > div. { display: table-cell;} is causing this issue and instead of working on patches let's hit the problem head straigh on instead of working on fixes.
Just get rid of the display table etc. And use floats instead here is an example:
http://jsfiddle.net/YNyHW/6/

CSS table width rule

I am supporting a legacy application.
In the CSS there is the following rule:
.dashboard-panel table {
width: 100%;
}
So basically there are many panels, and for all tables in them the width is set to 100%.
Now the problem: in a dashboard panel I have put a calendar control from an external library (richfaces). This calendar control is using a table for displaying the days. And this width:100% is affecting the calendar table.
Example:
<div class="dashboard-panel">
<div id="content">
<table id="table1"> //this is ok
<tr>
<td>
<table id="richfacesCalendarTable"> //this not ok
</table>
</td>
</tr>
</table>
</div>
</div>
What is the proper solution here?
I don't want to go through every panel in this application and put a separate style there.
Mabye if you add something like that into end of your css:
.dashboard-panel table#richfacesCalendarTable {
width: your_desired_width_px !important;
}
or
.dashboard-panel table#richfacesCalendarTable {
width: auto !important;
display: table !important;
}
Hard to say for sure as this is only a small portion of HTML and CSS code you provided. There can be other elements that affects your result.

Creating complex div structure using CSS

I'm attempting to create a complex div structure using CSS.
I want it to be made up of four columns. On the left is just a list of images. On the right is the complex div structure that I can't figure out a way to create. There should be two large vertical boxes containing various details. In-between these vertical boxes are any number of horizontal boxes.
My problem is that I cannot work out how to create this div structure in a way that 'scales', i.e. there could be any number of horizontal boxes between the two vertical boxes.
This is the div structure I was attempting to use:
<div class="result">
<div class="detail_1">
<p>Detail 1</p>
</div>
<div class="details">
<p>Details</p>
</div>
<div class="details">
<p>Details</p>
</div>
<div class="detail_2">
<p>Detail 2</p>
</div>
</div>
Any help would be greatly appreciated!
EDIT: I have fixed this problem by just using tables. Thanks for the replies.
Update 2
Your question is: How to make the price & flight_number div the same height as the parent div (container)..
1) Use the technique described here: http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks
2) update your CSS so that the flight number and the price are vertical aligned in the middle of their div.
I think that mine HTML structure is better then yours because it's more clear and easier to work with.
So based on my HTML structure: The parent container (flight_info) is stretchend as long as the content inside (the table with the rows will be the longest). the div's flight_number and price are also the total height of the parent container thanks of the technique described in step 1 above. The extra CSS (step 2) will align the price and flight number nicely in the middle.
OLD
<ul id="flights">
<li>
<ul class="images">
<li><img src="img1" alt="your image" /></li>
<li><img src="img2" alt="your image 2" /></li>
</ul>
<div class="flight_info" id="flight_EK49">
<div class="flight_number">
EK49
</div>
<table>
<thead>
<th>date</th>
<th>from</th>
<th>to</th>
</thead>
<tbody>
<tr>
<td>1/1/2013</td>
<td>departure airfield</td>
<td>destination airfield</td>
</tr>
...
</tbody>
</table>
<div class="price">
€999,99
</div>
</div>
</li>
// duplicate the above for a new flight..
</ul>
And for the CSS style (you must do the rest on your own because this is just an example. I didn't test any of the code):
<style>
#flights .images {
float: left;
width: 250px;
}
.flight_info {
float: left;
width: 700px;
}
.flight_info .flight_number,
.flight_info .price {
float: left;
width: 150px;
}
.flight_info .price {
float: right;
}
.flight_info table {
float: left;
width: 400px;
}
</style>
I think you will get the idea.
EDIT 1
Changed all the position absolutes to floats because it easier with the li's automatic heights.
I also added the leg images of the flight as well, but as I mentioned, you have to do the rest yourself ;)

Resources