我有oracle函数在发送前格式化邮件数据。函数由 apex 中的 pl/sql 进程调用。但是我对邮件的 css 格式有一个小问题。我想要固定宽度为 750px 的 div。我的表格和其他元素将适合这个指定的宽度。问题是,当我定义固定宽度的 div 时,它不起作用。我已经在 jsfiddle 上试过了,它可以工作,但在 oracle 函数中不起作用。当我将其他 div 参数定义为字体大小、颜色、边框等时,它起作用了。但我无法更改 div 的宽度。这是我的功能:
create or replace FUNCTION "SEND_MAIL" RETURN varchar2
AS
PRAGMA AUTONOMOUS_TRANSACTION;
kontr_tema varchar2(500);
komentar varchar2(2000);
obl varchar2 (100);
riz varchar2 (1);
riz_warning varchar2(100);
last_report_id number;
vystup varchar2(2601);
begin
select RIZIKO into riz from AUDIT_REPORTS
where REPORT_ID =
(select max(REPORT_ID) from AUDIT_REPORTS);
select OBLAST into obl from AUDIT_REPORTS
where REPORT_ID =
(select max(REPORT_ID) from AUDIT_REPORTS);
FOR x in(select OPIS_KONTROLY from AUDIT_REPORTS
where REPORT_ID =
(select max(REPORT_ID) from AUDIT_REPORTS))
loop
komentar := ''||x.OPIS_KONTROLY||'<br />';
end loop;
FOR x1 in(select KONTROLNA_TEMA from AUDIT_REPORTS
where REPORT_ID =
(select max(REPORT_ID) from AUDIT_REPORTS))
loop
kontr_tema := ''||x1.KONTROLNA_TEMA||'<br />';
end loop;
vystup := '
<html>
<head>
<style type="text/css">
div{
position:relative;
width:750px;
border: 1px solid black;
border-collapse: separate;
}
</style>
<style type="text/css">
"table,th,td" {
border: 1px solid black;
border-collapse: separate;
width:100% !important;
}
</style>
</head>
<body>
<div>
<table border = "1">
<tr>
<th>Oblasť</th>
<th>Riziko</th>
<th>Kontrolná téma</th>
<th>Komentár</th>
</tr>
<tr>
<td>'||obl||'</td>
<td>'||riz||'</td>
<td>'||kontr_tema||'</td>
<td>'||komentar||'</td>
</tr>
</table>
</div>
</body>
</html> ';
return vystup;
commit;
end;
最佳答案
参见 this answer .问题不在 Oracle 或 APEX 中,而是电子邮件客户端经常忽略 CSS header ,您应该避免使用它们,而是使用内联样式,例如
<div style="width: 750px">...</div>
关于html - oracle函数中div的固定宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45785187/