Driving myself nuts here!.
Firstly can I just clarify that it is no longer necessary to prefix border radius eg with -moz-. But is it good practice to do so in case an old browser is employed?
Secondly I accept that in employing a border radius inside a table demands that border-collapse is not collapse I also believe that border-spacing should not be 0.
The following draft CSS & HTML creates nicely rounded table elements in all browsers except mozilla where for some reason the table is rounded the th is rounded BUT the td's are all square.
Fire bug reports that the radius is applied. Indeed if I place a background colour on td I can see that this background is rounded. But it still displays the remainder as square.
Any thoughts ???
/* borders */
#booking_Form_Wrapper{
border: 0px;
padding: 0px;
margin: 0px;
}
#booking_Table{
width: 300px;
height: 400px;
background-color: #a5a5a5;
border-radius: 14px;
border-spacing: 6px 6px;
}
#booking_Table th{
border-radius: 10px;
}
#booking_Table td{
border-radius: 10px;
}
/* other styles */
HTML
<table id="booking_Table">
<thead id="booking_Title">
<th>
Booking
</th>
</thead>
<tbody>
<tr id="booking_Session">
<td>
<a>Class - Level</a><br />
<a>Day and Date</a><br />
<a>Start Time - End Time</a>
</td>
</tr>
<tr id="booking_XXXXXXX">
<td style="border-radius: 6px;">
<label>Do you want to XXXXXXXX</label><input type="checkbox"/>
<label>XXX</label><input type="radio" name="XXX" value="b">
<label>XXX</label><input type="radio" name="XXX" value="s">
<label>XXX</label><input type="radio" name="XXX" value="r">
</td>
</tr>
<tr id="booking_Cancel">
<td>
<P><span>Cancellation Policy</span> - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</P>
</td>
</tr>
<tr class="form_Footer">
<td>
<input class="form_Submit" type="submit" name="submit" value="Make Booking"/>
<input class="form_Cancel" type="cancel" name="cancel" value="Cancel"/>
</td>
</tr> <!-- form footer -->
</tbody>
</table> <!-- booking table -->
Here is the firebug computed style info for the first square td
I found the solution - I may not be stating this in the correct technical terms but the effect was caused in FF by giving the containing element a height. In my case the <tr>. The interesting thing is that none of the other browsers complain about this and round the <td> regardless. I think that this is connected to the mozilla developer notes which say that the radius is applied to the background of the element where the radius is applied regardless of whether a border is specified or not. The <tr> was not part of the background and so was not rounded.
Anyway don't give the container a height and everything good.
Related
Recently, I had a case where the has() selector seemed to provide the answer to a problem. And I found that it isn't. And not because FireFox doesn't support it. (Although that is a problem too.)
To show this I made a codepen lookahead selector is weird
The bit with class v1 is the first solution I came up with. And I have no idea why it doesn't work.
When I saw v1 didn't work, I came up with the alternative with class v2. That also didn't work. But I could at least understand why.
Considering that the halves that did work cover all that I need, I made the one with class v3.
Intrigued by v1 not working, I also made v1a,to see if I could figure out which part of the selection doesn't do what I think it does.
And that shows just how weird has() is. Adding the rule for the background of the table flipped the does/doesn't work on the rules.
Also, by accident, I ended up wildly moving across the elements of the table of v1. And at some moment...both rules started working. For v1a, the same. If you want to see this, just make circles on the v1 table hitting all the tds until you see both spans on the right responding.
I tried with both Chrome and Edge. FireFox simply doesn't support it. And I don't happen to have Safari handy to try it on.
Can anyone give an explanation so I understand what is going on? Preferably with pointers to getting something that works in a way that makes a bit more sense.
td {
border: 1px solid black;
}
table {
background-color: skyblue;
margin: 10px;
}
span {
display: inline-block;
padding: 5px;
}
.v1a:has(td .span1:hover) {
background-color: green;
}
.v1:has(td .span3:hover) tr td .span2, /* Ok */
.v1:has(td .span1:hover) tr td .span4 { /* NOk. Why? */
background-color: red;
}
.v2 tr:has(td .span3:hover)~tr td .span2, /* NOk, but I know why. */
.v2 tr:has(td .span1:hover)~tr td .span4 { /* Ok */
background-color: red;
}
.v3:has(td .span3:hover) tr td .span2, /* Ok */
.v3 tr:has(td .span1:hover)~tr td .span4 { /* Ok */
background-color: red;
}
<table class="v1">
<tr>
<td>
<span class="span1">1</span>
</td>
<td>
<span class="span2">2</span>
</td>
</tr>
<tr>
<td>
<span class="span3">3</span>
</td>
<td>
<span class="span4">4</span>
</td>
</tr>
</table>
<table class="v1 v1a">
<tr>
<td>
<span class="span1">1</span>
</td>
<td>
<span class="span2">2</span>
</td>
</tr>
<tr>
<td>
<span class="span3">3</span>
</td>
<td>
<span class="span4">4</span>
</td>
</tr>
</table>
<table class="v2">
<tr>
<td>
<span class="span1">1</span>
</td>
<td>
<span class="span2">2</span>
</td>
</tr>
<tr>
<td>
<span class="span3">3</span>
</td>
<td>
<span class="span4">4</span>
</td>
</tr>
</table>
<table class="v3">
<tr>
<td>
<span class="span1">1</span>
</td>
<td>
<span class="span2">2</span>
</td>
</tr>
<tr>
<td>
<span class="span3">3</span>
</td>
<td>
<span class="span4">4</span>
</td>
</tr>
</table>
I expected all browsers behave the same, which is setting all tds in a table to the width of the largest width indication of all tds.
Take a look at the following examples:
https://jsfiddle.net/rpkbf4n6/
=> This one is displayed correct in FF/IE but wrong in Edge (the very long text is not wrapped)
https://jsfiddle.net/8oa4fw2u/
=> This one is displayed correct in FF/IE/Edge
Why is this? I don't like to give all tds the width attribute and I don't like to give the width attribute to the largest content td (because the content is filled dynamically, so I don't know which is the largest)
Add a DIV above the table and use table-layout: fixed then it works with Edge
<div class="wrap">
<table class="table">
<tbody>
<tr>
<td style="width:100px;">
<span>Text</span>
</td>
<td>
<input style="width:160px;">
</td>
</tr>
<tr>
<td>
<span>Very very very very very long text</span>
</td>
<td>
<input type="checkbox">
</td>
</tr>
</tbody>
</table>
</div>
.wrap {
width: 500px;
}
.table {
width: 100%;
table-layout: fixed
}
I have a table where one of the cells is like this:
<td>
<div class="table-wrapper">
<table class="inner-table">
<!--content-->
</table>
<div>
</td>
The div is there so I can put a border around the table, with a gap of 10px. As it displays, though, the div is the entire width of the enclosing td. What I would like is for it to be just the width of the table it wraps (plus margin, to be specified). I can't figure out the CSS to do this, simple though it no doubt is, although I've got it working with Javascript - but I would prefer to do it using CSS, if possible. I had hoped setting width:auto for the div would work, but it makes no difference,
One way is to use inline-block
<style>
.table-wrapper {
border : 1px solid black;
padding : 10px;
display : inline-block;
}
</style>
<table width="400px">
<tr>
<td>
OUTER
</td>
<td>
<div class="table-wrapper">
<table class="inner-table">
<tr><td>INNER</td></tr>
</table>
<div>
</td>
</tr>
</table>
I have no problem getting this to work in Firefox. The program is that Chrome hides the text below the bottom of the input box. I think Chrome is only using the body tag's font and height and ignoring class completely as a stupid thing with stupid values that it thinks is not valid because it results in a super thin input box, which is by design. The user is only suppose to put in " _ " to "underline" the letter.
NOTE: Flex boxes do not work because Flex box is all about the content moving to fit the screen. I am trying to do something more akin to a Word Find where the user would simply put a "=" in the in put box, to indicate that they are underlining the letter. I need the input boxes and the letters to line up both Vertically and Horizontally.
UPDATE:
Flex box will wrap to the next line after you've closed your screen enough. I do not want a code that thinks for me. I know where I want things. Besides, Flex boxes do not make INPUT boxes allow input that shows up! Flex boxes do NOT have a thing to do with input boxes. The problem is that Chrome needs a HACK to force its God Code to stop playing God on my page. This is why I think I will just throw out Chrome and just use Firefox. At least Firefox actually ALLOWS MY CSS instead of ignoring it because IT thinks that IT knows best!
Things I have tried:
Changing Font size both increasing and decreasing the size.
Commenting out/not commenting out height, vertical-align, line-height values.
Thanks!
EDIT: The HTML and Updated CSS, and gave the JS too.
<tr>
<td> </td>
<td class="grey"> Q </td>
<td class="grey"> A </td>
<td class="grey"> F </td>
<td class="grey"> O </td>
<td class="grey"> U </td>
<td class="grey"> R </td>
</tr>
<tr>
<td> </td>
<td><input class="zthin" type="text" name="c1" size="1"> </td>
<td><input class="zthin" type="text" name="c2" size="1"> </td>
<td><input class="zthin" type="text" name="c3" size="1"> </td>
<td><input class="zthin" type="text" name="c4" size="1"> </td>
<td><input class="zthin" type="text" name="c5" size="1"> </td>
</tr>
CSS Updated:
BODY {
background-color: #000000;
background-image: url(/w5jyz84kw0dle38f19s0xceydkoyjs/velvela/gaming/2/word/xw/xwcss/ngc3.jpg);
background-repeat: repeat-y;
background-position: top left;
border: 0px; height: 100%; width: 100%;
margin: 0px 0px 0px 0px;
}
input.zthin {
background-color: #c1c1c1;
border: 2px solid #0000ff;
font-size: 10pt;
height: 10pt;
line-height: 10pt;
padding:0px;
width:20px;
z-index: 1;
}
JS:
<script type="text/javascript">
function jyzcrossWord(){
if (document.form.c1.value=="-"
&& document.form.c2.value=="-"
&& document.form.c3.value=="-"
&& document.form.c4.value=="-"
&& document.form.c5.value=="-"
)
alert("Congratulations! All is correct!")
else {alert("Not correct. Please check your answers.")}
}
</script>
Lastly, when I put '-' into the input box, I do not see it at all. If put 'm' I only see the upper half of the 'm'. In Firefox, it shows up properly. Also, class grey does not matter, as that part of the css was not the issue. Thanks!
I have problem with absolute positioning DIV over the table element. I have a DIV that’s set the position absolute and set the top position to display the exact place. Now what happened in chrome browser while zooming (ctrl +) the DIV position has been changed at zoom level 125, 150, 175 ... etc. But Zoom level 100,200, 300… (Multiple of 100) it’s displayed the same position. The problem was other than the multiple of 100 zoom level the DIV position changed. How can I fix this issue ?
I have created the sample page in jsfiddle - demo . please run the page in chrome browser and zoom the browser ( ctrl + ) the red color DIV position will be change, this is the issue. I really hope someone find a solution for this.
HTML :
<div class="container">
<table width="700px" class="custom">
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<div>
<div class="apptest"> </div></div>
CSS :
table
{
border-collapse:collapse;
}
.custom tr td
{
height:20px;
border:1px solid;
background-color:White;
}
.container {
position: relative;
}
.apptest
{
height:70px;
width:400px;
position:absolute;
top:185px;
left:0px;
background-color:Red;
}
Link : http://jsfiddle.net/mJcsb/5/
Use a container with a style like this;
.Container {
margin-right: auto;
margin-left: auto;
width: 500px;
}
I'm not going to debate whether tables are a poor choice or not these times. But an absolute positioning here is a pretty bad idea.
I don't know what you have to do and what is your aim, but you could have a different (and probably better) solution using divs; in that case, a div containing your "red" div would just.. contain it, heh!
If you want to go anyway with absolute positioning and tables, be aware that this is a dirty solution and could break anytime. In that case, I'd suggest you to go with percentage-based absolute positioning, so that the box flows with the zoom (that is, by the way, difficult to predict and normalize in every browser).
i.e.
.apptest
{
height:70px;
width:400px;
position:absolute;
top:61.2%;
left:0px;
background-color:Red;
}
A fork of you fiddle with percentage for absolute positioning (POOR SOLUTION WARNING HERE): http://jsfiddle.net/U4TGd/
Keep in mind that, again, this is a bad solution and mixing percentages and pixels in often a bad idea. If you have time or possibility, convert your table-based design and use divs instead of tabs.
Its not the div position which was changing, the one which our eye relates the div position was changing(in this case the table border of each cell).
I found out this with some testing,
use this css to know that the absolute position div is in exact position.
.custom tr td {
height:20px;
border:0px solid;
}
.container {
position: relative;
height:185px;
background:#0F6;
}
.apptest {
height:70px;
width:400px;
position:fixed;
top:185px;
left:0px;
background-color:Red;
}
So you have no problem with absolute positioning DIV, but maybe chrome rendering the table cells differently.