I am inserting the <audio> tag into a table that uses a caption as the table title. In most browsers the caption appears at the top of the table, but in Safari it appears at the bottom of the table.
Tested on Safari 11 on Mac OS "el Capitan".
Note:
The caption only changes to the bottom when using the <audio> tag (without the <audio> tag, the caption appears at the top)
The audio plays fine.
Here's part of the HTML:
<table>
<caption class="paragraphheader">
Ordinal Numbers 0 to 9
</caption>
<tr>
<th scope="col">Number</th>
<th scope="col">Name</th>
<th scope="col">Pronunciation</th>
</tr>
<tr>
<td>0<sup>th</sup> *</td>
<td>Zeroth <br /></td>
<td>"<span class="textblue">z</span>
<span class="textblue">ie</span>
<span class="textblue">r</span>
<span class="textorange">o</span>
<span class="textblue">th</span>"<br />
<audio controls controlsList="nodownload" preload="auto" style="width:66px">
The css related to tables:
table {
border-width: 1px;
border-style: ridge;
margin-left: inherit;
padding: 2px;
width: 98%;
float: right;
caption-side: top;}
td {
border-width: 1px;
border-style: inset;
padding:2px
}
th {
border-width: 1px;
border-style: inset;
}`
Here is the site (I'm still working on it, so may change)
http://www.simpleenglish.info/numbers-ordinal.html
This is driving me nuts! Any suggestions?
Related
I have a simple CRUD application with following model, List View and DetailView, where ListView is paginated by 5 items per page.
I want to put a back button on DetailView such that it will take me back to the page of ListView from which DetailView was accessed instead of going to the first page.
Similarly from DeleteView after success, I want to come back to the page in ListView where the deleted object was instead of going to first page.
The code is below.
Model
class BankAcType(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT)
name = models.CharField(max_length=100, verbose_name="Bank Account Type")
created_date = models.DateTimeField(default=timezone.now)
active = models.BooleanField(default=True)
def __str__(self):
return self.name
ListView
class BankAcType_List(generic.ListView):
paginate_by = 5
def get_queryset(self):
return BankAcType.objects.filter(author=self.request.user).order_by('-created_date')
DetailView
class BankAcType_Detail(DetailView):
model = BankAcType
urls.py
path('bankactype_list/', views.BankAcType_List.as_view(), name='bankactype_list'),
path('bankactype_detail/<int:pk>/', views.BankAcType_Detail.as_view(), name='bankactype_detail'),
DetailView Template
{% extends 'base_admin.html' %}
{% block content %}
</br></br>
<h2 style="text-align: center;">Bank Account Type Detail View</h2>
</br>
<div style="text-align: right; width: 60%; margin-left: auto;margin-right: auto;">
<img src="/static/images/delete.png" alt="Edit" width="30" height="30"> <img src="/static/images/edit.png" alt="Edit" width="27" height="30">
</br></br>
<table class="table-bordered" style="width: 100%; padding: 2px; margin-left: auto;margin-right: auto;" >
<tr>
<td style="background-color: #000000; color: #ffffff; padding-right: 10px;">Bank Account Type</td>
<td style="background-color: #ffffff; color: #000000; text-align: center;">{{ bankactype.name }}</td>
</tr>
<tr><td style="background-color: #ffffff;"></td><td style="background-color: #000000;"></td></tr>
<tr>
<td style="background-color: #000000; color: #ffffff;padding-right: 10px;">Status</td>
<td style="background-color: #ffffff; color: #000000; text-align: center;">{{ bankactype.active|yesno:"Active, Inactive" }}</td>
</tr>
</table>
</div>
</br></br>
<div style="text-align: right; width: 60%; margin-left: auto;margin-right: auto;">
<button style="background-color: #42c8f5; box-shadow: 10px 10px 25px -7px rgba(60,60,214,1.00); font-weight: bold; color: #054d05; float: left;">Back to List</button>
</div>
{% endblock%}
I was able to do it the following way.
First find the position of the object in the list and then use it to get a page number on the list in the view and pass it in context to the page. (See View Below)
Next in the template use the page number received from the view to build url for the back button. (See Template below)
View
class BankAcType_Detail(DetailView):
model = BankAcType
pk = BankAcType.pk
def get_context_data(self, **kwargs):
context = super(BankAcType_Detail, self).get_context_data(**kwargs)
pk = self.kwargs['pk']
blist = BankAcType.objects.filter(author=self.request.user).values_list('pk', flat=True).order_by('-created_date')
position = list(blist).index(pk)
if position == 0:
page = "1"
else:
page = math.floor(position/5)+1
context ['page'] = page
return context
Template
Back
I recently reviewed the Pluralsight course on HTML email and then made a sample for myself. I tested it through Mailchimp and the Mailchimp test environment renders it as expected for both mobile and desktop, but when I sent a test email to myself, both gmail clients that I use (Gmail app through Chrome on desktop and Android app on mobile) appeared to strip the style and link tags, in particular stripping the media screen size queries and associated classes, as well as font imports.
This article claims that gmail clients are now accepting tags, at least on most platforms, including the two I am testing. However, as noted the #media and #import queries are not working. (1) Is there something obviously wrong with my code?, or (2) is this an issue with Mailchimp?
HTML email code, and part of
<!DOCTYPE html>
<html lang="en">
<head>
<title>Happy Holidays!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link href="https://fonts.googleapis.com/css?family=Cabin|Libre+Baskerville|Pacifico" rel="stylesheet">
<style type="text/css">
/* CLIENT-SPECIFIC STYLES ------------------- */
#outlook a {
padding: 0; /* Force Outlook to provide a "view in browser" message */
}
.ReadMsgBody {
width: 100%; /* Force Hotmail to display emails at full width */
}
.ExternalClass {
width:100%; /* Force Hotmail to display emails at full width */
}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
line-height: 100%; /* Force Hotmail to display normal line spacing */
}
body, table, td, a { /* Prevent WebKit and Windows mobile changing default text sizes */
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
table, td { /* Remove spacing between tables in Outlook 2007 and up */
mso-table-lspace: 0pt;
mso-table-rspace:0pt;
}
img { /* Allow smoother rendering of resized image in Internet Explorer */
-ms-interpolation-mode: bicubic;
}
/* RESET STYLES --------------------------- */
body {
height: 100% !important;
margin: 0;
padding: 0;
width: 100% !important;
}
img {
border: 0;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
}
table {
border-collapse: collapse !important;
}
a {
text-decoration: none;
}
/* iOS BLUE LINKS */
.apple-links a {
color: #A50001;
text-decoration: none;
}
/* FONTS */
#import url('https://fonts.googleapis.com/css?family=Cabin|Libre+Baskerville|Pacifico');
/* MOBILE STYLES ------------------------ */
#media only screen and (max-width: 600px) {
td[class="logo"] img {
margin: 0 auto !important;
}
table[class="wrapper"] {
width: 100% !important;
}
td[class="mobile-image-pad"] {
padding: 0 10px 0 10px !important;
}
td[class="mobile-title-pad"] {
padding: 10px 0px 0px 10px !important;
}
td[class="mobile-text-pad"] {
padding: 10px 10px 10px 10px !important;
}
td[class="mobile-column-right"] {
padding-top: 20px !important;
}
img[class="fluid-image"] {
width: 100% !important;
height: auto !important;
}
td[class="hide"] {
display: none !important;
}
td[class="mobile-button"] {
padding: 12px 60px 12px 60px !important;
}
td[class="mobile-button"] a {
font-size: 24px !important;
}
}
</style>
</head>
<body style="margin: 0; padding: 0;" >
<!-- CONTAINER TABLE (HEADER) -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style=" table-layout: fixed;">
<tr>
<td align="center" bgcolor="#339969" style="padding: 0 0 0 0;">
<!-- HIDDEN PREHEADER -->
<div style="display: none; font-size: 1px; color:#333333; line-height: 1px; font-family: Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden; mso-hide: all;">
Preheader inbox text
</div>
<!-- WRAPPER TABLE -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="wrapper">
<!-- HEADER -->
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" background="img/url" alt="Bappy Bolidays!" width="100%" height="100" style="background-size:contain;">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- CONTAINER TABLE (HERO) -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="table-layout: fixed;">
<tr>
<td align="center" bgcolor="#C3D79C" style="padding: 20px 0 20px 0;">
<!-- WRAPPER TABLE -->
<table border="0" cellpadding="0" cellspacing="0" width="600" class="wrapper">
<tr>
<td>
<!-- TWO COLUMNS -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<!-- LEFT COLUMN -->
<table border="0" cellpadding="0" cellspacing="0" width="64%" align="left" class="wrapper">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="mobile-image-pad">
<img src="img/url" alt="Two Beautiful Peeps" width="384" height="288" border="0" style="display: block; image-orientation: from-image; color: #A50001; font-family: Arial, sans-serif; font-weight: bold; font-size: 24px; background-color: #339969; -webkit-border-radius: 4px; border-radius: 4px;" class="fluid-image" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- RIGHT COLUMN -->
<table border="0" cellpadding="0" cellspacing="0" width="30%" align="right" class="wrapper">
<tr>
<td valign="middle" height="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" style="color: #A50001; font-family: 'Libre Baskerville', serif; font-weight: bold; font-size: 32px; line-height: 38px; text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);" class="mobile-title-pad">
Title
</td>
</tr>
<tr>
<td align="center" style="color: #339969; font-family: 'Cabin', sans-serif; font-weight: bold; font-size: 20px; line-height: 24px;" class="mobile-title-pad">
from
</td>
</tr>
<tr>
<td align="center" style="color: #A50001; font-family: 'Libre Baskerville', serif; font-weight: bold; font-size: 32px; line-height: 38px; text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);" class="mobile-title-pad">
Title
</td>
</tr>
<tr>
<td align="center" style="padding: 20px 0 0 0;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#339969" style="padding: 12px 18px 12px 18px; -webkit-border-radius:3px; border-radius:3px; -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); -moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2); box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);" class="mobile-button">
let's go champ →
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- CONTAINER TABLE (VIGNETTES) -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="table-layout: fixed;">
<tr>
<td align="center" bgcolor="#fff2f9" style="padding: 40px 0 40px 0;">
<!-- WRAPPER TABLE -->
<table border="0" cellpadding="0" cellspacing="0" width="600" class="wrapper">
<tr>
<td>
<!-- TWO COLUMNS (ROW 1) -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<!-- LEFT COLUMN -->
<table border="0" cellpadding="0" cellspacing="0" width="47%" align="left" class="wrapper">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="mobile-image-pad">
<a href="album/location" target="_blank">
<img src="img/url" alt="Kapanda" width="280" height="218" border="0" style="display: block; padding: 0; color: #ffffff; font-family: Arial, sans-serif; font-weight: bold; font-size: 18px; background-color: #589263; -webkit-border-radius: 4px; border-radius: 4px;" class="fluid-image" />
</a>
</td>
</tr>
<tr>
<td align="left" style="padding: 20px 0 0 0; color: #A50001; font-family: 'Libre Baskerville', serif; font-weight: bold; font-size: 18px; line-height: 22px; text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);" class="mobile-title-pad">
Title
</td>
</tr>
<tr>
<td align="left" style="padding: 10px 0 10px 0; color: #666666; font-family: 'Cabin', sans-serif; font-weight: normal; font-size: 18px; line-height: 22px;" class="mobile-text-pad">
description more description!
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- RIGHT COLUMN -->
<table border="0" cellpadding="0" cellspacing="0" width="47%" align="right" class="wrapper">
<tr>
<td class="mobile-column-right">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="mobile-image-pad">
<a href="album/location" target="_blank">
<img src="url/img" alt="Hawaii Sunset" width="280" height="218" border="0" style="display: block; padding: 0; color: #ffffff; font-family: Arial, sans-serif; font-weight: bold; font-size: 18px; background-color: #589263; -webkit-border-radius: 4px; border-radius: 4px;" class="fluid-image" />
</a>
</td>
</tr>
<tr>
<td align="left" style="padding: 20px 0 0 0; color: #339969; font-family: 'Libre Baskerville', serif; font-weight: bold; font-size: 18px; line-height: 22px; text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);" class="mobile-title-pad">
Title
</td>
</tr>
<tr>
<td align="left" style="padding: 10px 0 10px 0; color: #666666; font-family: 'Cabin', sans-serif; font-weight: normal; font-size: 18px; line-height: 22px;" class="mobile-text-pad">
Description More description.
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
Gmail generally doesn't support web-fonts. If you have a web font installed on your own computer, you’ll be able to see it in Gmail, but that's it.
Gmail supports #media queries almost everywhere, but not everywhere. The Litmus article you referenced contains a support table of Gmail products and their #media query support.
There's little telling which product MailChimp Or Litmus are using to generate their previews, so it could look fine on their end and break in your account... with no error on either end.
You said that you checked using Android app on mobile, and that seems like one of the Gmail products that doesn't support media queries ↓ ↓ ↓
This is pure conjecture, but from what I understand Google is done rolling out this change. So those red x's might remain unsupported for some time.
Gmail does support style blocks, but doesn't support selectors in CSS. Remove the selectors and your CSS will work. For example, change:
td[class="mobile-text-pad"]
to:
td.mobile-text-pad
And it should work.
I'm very new to coding and am taking a class to learn HTML5 and CSS3.
I have an old file however, that I need to update quickly for a client. It's set up with tables and inline styles which I know is a bit sloppy so I'm just trying to clean it up a little bit and get it to validate. I was able to get the file down from about 50 errors to just one but am stuck on figuring out this last part. Can someone point me in the right direction?
Thanks!
Line 68, Column 32: there is no attribute "background"
The DOCTYPE is XHTML 1.0 Transitional.
<tr>
<td colspan="3" background="http://www.website.com/image.jpg" align="left" style="font-family:museo300, Arial, Helvetica, sans-serif; font-size:32px; color:#145099; padding:0px 50px 0px 50px; line-height:38px;">Headline.
</td>
</tr>
I tried changing it to inline CSS using this code but now I have no background image. Can you tell me what I'm doing wrong? It looked fine before.
<tr>
<td colspan="3" align="left" style="font-family:museo300, Arial, Helvetica, sans-serif; font-size:32px; color:#145099; padding:0px 50px 0px 50px; line-height:38px; background-image:http://www.website.com/image.jpg;">Headline.
</td>
</tr>
I figured it out. I was coding the CSS wrong, should have been:
<tr>
<td colspan="3" align="left" style="font-family:museo300, Arial, Helvetica, sans-serif; font-size:32px; color:#145099; padding:0px 50px 0px 50px; line-height:38px; background-image: url(http://www.website.com/image.jpg);">Headline.
</td>
</tr>
Thanks for the help!
Since 1996, you should use the CSS background-image property.
I am trying to have the entire table cell be a link that changes background color on hover.
It used to be simple with Javascript but I can't get that to work any more.
Now I can't get this to work either.
The entire table cell is clickable (good) but no color change (bad).
What am I doing wrong?
<table width=980 height=100 style="margin:10px;">
<tr>
<td align="center" valign="middle" width="20%" height="40" style="vertical-align:middle;border:5px solid #899e7d;">
<a class="ClickCell" href="who.php">About Us</a>
</td>
</tr>
</table>
.ClickCell {
color:#cf9654;
cursor:hand;
display:block;
font-size:32px;
height:100%;
margin: -10em;
padding: 10em;
text-decoration:none;
width:100%;
}
.ClickCell:hover {
background-repeat: no-repeat;
background-position: left;
}
.ClickCell:hover a {
background-color: #FFFF00;
}
The problem is the you are calling an anchor tag within the ClickCell object. The anchor tag is the ClickCell object. Instead, add a class to the cell and just change the cell directly, because the anchor tag within is an inline element anyway. For example:
td.HoverCell:hover {
background-color: red;
}
JSFiddle of the solution:
http://jsfiddle.net/D2bA3/
I cannot get "text-overflow: ellipsis;" to work...
Maybe someone can give ma some help with that one :-)
Small example:
http://jsfiddle.net/qKS8p/2/
http markup:
<table class="" border="1">
<tr><td colspan=3>…</td></tr>
<tr class="">
<td width="90"><span class="prose">column one</span></td>
<td width="20"><span class="prose">column two</span></td>
<td width="90"><span class="prose">column three</span></td>
</tr>
<tr><td colspan=3>…</td></tr>
</table>
css style rules:
.prose {
overflow: hidden;
white-space: nowrap;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
text-overflow: ellipsis;
}
I would expect "column two" to be chopped because of the td's width of 20px. I also tried different variants with divs, tds etc, but I cannot see any change. Note, that this does not work in any browser I checked. So there is certainly something I miss.
There are millions of pages out there about examples, browser differences and and and. But I cannot get this to work ! According to current information the simple text-overflow attribute is supported in all major browsers now. So I am looking for a pure css solution (not xul, not jquery plugin), since this should work.
Thanks,
arkascha
This fiddle works for me: http://jsfiddle.net/wRruP/3/
HTML
<div><span>column one</span></div>
<div>column two</div>
<div><p>column three</p></div>
### CSS
div {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 40px;
}
It seems like text-overflow has to be set on the block that's actually constraining the width of the text. <span> is an inline element that doesn't really have a width and thus can't really cut off text, and when I nested a <p>, it didn't inherit the property.
The problem with the code in the example is that the tables automatically enlarge and ignore the set width of 20px if there's more content then 20px.
Here's an example that works: http://jsfiddle.net/qKS8p/34/
I added:
span {
display:block;
width:inherit;
}
Try setting both the text-overflow property and the fixed width on the same block-level element (such as a div), like this:
<table class="" border="1">
<tr><td colspan=3>…</td></tr>
<tr class="">
<td><div class="prose" style="width: 90px">column one</div></td>
<td><div class="prose" style="width: 20px">column two</div></td>
<td><div class="prose" style="width: 90px">column three</div></td>
</tr>
<tr><td colspan=3>…</td></tr>
</table>
With your original CSS:
.prose {
overflow: hidden;
white-space: nowrap;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
text-overflow: ellipsis;
}