I could use some assistance with a rendering issue from the IE7 experts out there; my layout works beautifully on all browsers except IE7, and I can't quite figure out the magic style to get it working.
JSFiddle example of the issue is here: http://jsfiddle.net/rB29C/2/
If you view it in IE7, the link (wineglass image) is pushed down to a second line below the checkbox. My goal is to have them in the same line. If you view the fiddle in IE8+ or any other browser, it is working as expected.
I think it has something to do with the width of the floated element, but I can't figure out the magic style combination to fix this. I do have conditional stylesheets in my app so I can do an IE7 specific style, though I prefer to avoid markup based changes if possible.
I'd love to understand what's going on, too--so I can hopefully learn to avoid this in the future :)
IE7 seems to push items in the cell to the bottom when the width of the cell is too small. I increased the width of td.type to 14% and it seemed to work in the fiddle, but if your table needs to shrink and grow this might not be the best solution(if the table is squished the wine glass will again drop to the bottom). Otherwise you may consider using a set pixel width instead of a %
I've figured it out and the solution is not in CSS but rather in the HTML. Simply move the wine glass picture between different cells like so:
<table>
<tbody>
<tr>
<td class="type">
<input class="checkbox" type='checkbox' />
</td>
<a class="link" href="#"></a>
<td class="name">Name
</td>
<td class="dates">Dates
</td>
<td class="score">Score
</td>
</tr>
</tbody>
</table>
The issue with this is that it only works in the IE7 environment and not in others. Maybe you could condition it with php depending on what browser the page is in.
<?php
$isIE7 = (get_broswer('broswer') == 'IE' && get_browser('version') < 8 )
?>
<table>
<tbody>
<tr>
<td class="type">
<input class="checkbox" type='checkbox' />
<?php if ($isIE7) echo('</td>
<a class="link" href="#"></a>');
else echo('
<a class="link" href="#"></a>
</td> ');?>
<td class="name">Name
</td>
<td class="dates">Dates
</td>
<td class="score">Score
</td>
</tr>
</tbody>
</table>
I'm not sure if you want to avoid php or not, but if you do there is also a JavaScript version I can crank out for you.
I was able to figure out a solution for my problem; I've updated the JSFiddle with the new styles:
http://jsfiddle.net/rB29C/13/
To summarize, I set the following additional style from my original fiddle, and IE now seems to layout and size things properly (including the containing td):
input.checkbox {
display: inline;
float: left;
}
a.link {
display: inline;
float: left;
clear: right;
margin: 0;
}
Hopefully this is helpful to someone else who is struggling with IE7's oddities!
Related
I'm strunggling at building E-Mail templates. Displaying some words inline using spans (trying to avoid the display property because some outlook versions don't support it) a floating problem occurs.
Problem case: the whole span including padding doesn't fit into the current line, so the text breaks into the next line - fine for now. The "left" padding though unfortunately stays in the first line and gets "cut off" the item as you can see in this screenshot.1
<span style=" line-height:25px; font-family:'Roboto', sans-serif; font-size:11px; background:#EBEBEB; border-radius: 8px;a padding: 3px 10px; margin:0;">
Vollzeit
</span>
<span> </span>
How can I force the padding to stick with the text and make it jump into the next line, too?
(This problem doesn't occur in outlook only but also on several other e-mail clients.)
You might try using tables instead since email clients have notoriously nasty support for a wide gamut of other markup and styles. Chris Coyier has a good article on responsive emails here https://css-tricks.com/ideas-behind-responsive-emails/ Look at the section specifically around 3 columns where he states:
You might think: each of those will be a <td>. But no, if that was the case you'd never be able to get them to wrap in the limited CSS world of emails.
It's yucky looking but, some variation of the following might work http://codepen.io/anon/pen/GoyojN
<table class="main-wrapping-table">
<tr>
<td>
<table align="left" style="width: 33.33%">
</table>
<table align="left" style="width: 33.33%">
</table>
<table align="left" style="width: 33.33%">
</table>
</td>
</tr>
</table>
So. I am creating a small site to test my capabilities.
In my site i have a page that in Firefox looks like this:
The additional files and additional actions buttons are inside a table. and each button is inside a <td> which are set to appear one under another with CSS using display:block; on the <td> element.
The problem is that when i open the page in IE9 or lower the td's are shown inline like this:
Because of this the responsiveness of the page is broken and resizing the viewport will move the page content below the left menu...
Here is the HTML of the tables:
<table class="buttons">
<tbody>
<tr>
<th colspan="2">Additional files:</th>
</tr>
<tr>
<td>
<a id="cv" href="">Curriculum Vitae</a>
</td>
<td>
<a id="cover" href="">Cover Letter</a>
</td>
</tr>
</tbody>
</table>
<table class="buttons">
<tbody>
<tr>
<th colspan="3">Additional actions:</th>
</tr>
<tr>
<td>
<a class="approve" href="">Denie</a>
<span style="display: none;">31</span>
</td>
<td>
Reply
</td>
<td>
Delete
</td>
</tr>
</tbody>
</table>
And this is the CSS:
.buttons {
float: left;
margin: 20px auto 0;
width: 50%;
}
.buttons td {
display: block;
width: 100%;
}
Can anyone suggest me a solution?
Thank you in advance!
You need to set table-layout: fixed; to your table and if still not working add a div inside td and manage the css which might work.
The real answer here is that you shouldn't be using <table> tags for this. What you have there is not a table, and so <table> is not semantically correct.
It's even worse because you're then overriding the default table layout by using display:block, which moves us even further away from wanting to use a <table>.
By using tables like this, and forcing the browser to restructure it with CSS, you're making it quite confusing for the browser. Particularly with the colspan attributes and then three columns of buttons, when you actually want them all in one column. Its easy to see why you'd get inconsistent behaviour with this, especially with older browsers.
So the solution here is to swap your <table> layout for a set of <div> elements. This will be semantically correct, and it will be easier to get it styled consistently. And you'll need less markup as well.
If you really want to carry on using tables for this layout, then you need to re-style all the elements -- display:block on the tr elements doesn't affect the display property of the table, tbody and tr elements, and these would also need to changed. But really, I would avoid that. Just use divs; it'll make things much cleaner.
So I have a site - on the Input Customer/Save Customer I have some buttons - they display correctly in IE 9 but not in Chrome (the functionality works fine in both) - its just for the appearence that I want to get it looking right in both.
So this is how it should look (IE 9)
And this is how it looks in Chrome (incorrect)
I have been trying different stuff in the source below - but havenet got it working in both Chrome and IE yet so maybe someone can spot something I'm missing.
<div class="PanelPadd" style="margin-top: 10px; text-align: right; padding: 5px; height:25px;">
<div id="Div8" style="text-align: right; float: right;">
<table>
<tr>
<td valign="middle" style="padding-right: 5px;">
<a id="FindCorrAddress" href="javascript:pageSMCustomerCreate.doRequest(2)">Find Addresses</a></td>
<td valign="middle" style="padding-right: 5px;">
<a id="ClearCAddress" href="javascript:pageSMCustomerCreate.doClearCAddress()">Clear</a></td>
<td valign="middle" style="padding-right: 5px;">
<asp:ImageButton ID="ImageButton4" ImageUrl="./images/buttons/SaveCustomer.gif" runat="server"
OnClick="OnSaveCustomer" /></td>
</tr>
</table>
</div>
</div>
There is nothing special done in any style sheet with the Class PanelPadd - a background color is set and a border is set as below.
.PanelPadd { background-color:#EFEFEF; border:solid #AAAAAA 1px; }
You do not show enough of your style code to analyze the problem. But I am assuming that you are setting a certain width to FindCorrAddress and ClearCAddress.
Because of minimal font-rendering differences, or rounding errors, or maybe even differences in the box model (are you running IE9 in Compatibility View?), a certain width that fits on one browser may not fit on another.
The best solution is to set no width at all, and to let the contents flow and define the width of the containers themselves.
Also, please remove the <table>. Using tables for layout is very bad style and asking for trouble.
I am trying to place a hyperlink vertically so it's to the middle of the height of a textbox but it's not working for me.
Here's the jsfiddle example. I want to do this without using Javascript, works in IE6+, the two elements need to be in the same td column, without using hard coded pixels, and the hyperlink to be right next to the right edge of the textbox (like it's shown in the example, just move it upward to the middle of the yellow box).
As long are the textarea and a elements are inline elements, they will share their base line. If you float the elements, you can set the line height of the a element to match the height of the textarea:
textarea { float :left; }
a { float: left; line-height: 6em; }
Demo: http://jsfiddle.net/Guffa/aLtXA/6/
Well, if you are willing to nest tables, this will work:
<table>
<tr style="vertical-align:top">
<td>
<table>
<tr style="width: 500px;">
<td>
<textarea cols="45" rows="5"></textarea>
</td>
<td style="background-color:yellow; vertical-align:middle">
Edit
</td>
</tr>
</table>
</td>
<td>
second cell
</td>
</tr>
</table>
but I hate this level of nested hell. It leads to madness and grey hair.
I hope someone will post a nicer answer.
Is it possible perhaps with the twitter bootstrap?
Here you go: http://jsfiddle.net/aLtXA/16/
I put vertical-align:middle on the TEXTBOX and anchor. As well, I removed the vertical-align from the table cell.
I wonder why IE doesn't seem to recognize the width I specify?
Basically I have this code:
<table>
<tr>
<td valign="top" align="right" class="left_frame"></td>
</tr>
</table>
CSS:
.left_frame {
background: url(images/side.gif) repeat-y;
width: 17px;
}
Even if I add width="17" inside the <td></td> tags, the width still doesn't change. This is quite frustrating because the problem seems to be very simple.
I'd say it's because there's no content in your <td>
Try adding a in there so the cell has some content, and see how that goes.
Alternatively, placing a height on the cell may work as well, depending on your requirements.
Basically the cell is a flat line at the moment, and needs something to tell it how tall it is, in order to draw the background in.
Example: http://jsfiddle.net/MvBf5/