无法更改表格的宽度
问题描述:
蓝色表格数据条目不会存在其宽度。有没有一种新的html5方法能够实现这一壮举?该行应该与上面的照片具有相同的宽度。无法更改表格的宽度<TD>
<div class="template" style="text-align:center">
<table width="100%" and height="100%" BORDER=0 CELLSPACING=0 CELLPADDING=0 align="center">
\t \t <tr>
\t \t \t <td width='100%' height='100%' bgcolor='#f2f3f4'>
\t \t \t \t <div style="text-align: center;">
\t \t \t \t \t \t <img src ="https://image.ibb.co/i4ykZk/roverlogo.png" alt="RoverLogo">
\t \t \t \t </div>
\t \t \t </td>
\t \t </tr>
\t
<!-- Background photo -->
\t <TABLE width="80%" BORDER="0" cellpadding="0" CELLSPACING="0" align="center">
\t <TR>
\t <TD WIDTH="997" HEIGHT="326"
background="https://image.ibb.co/dO1HfQ/dog3edit.jpg" style="background-
image:url(https://image.ibb.co/dO1HfQ/dog3edit.jpg); background-repeat:
no-repeat;">
\t <!-- <b>WELCOME TO ROVER! </b> -->
\t <FONT class="titletext" color="white" align="center" style="width: 800px;
\t font-size: 50px;"><b>WELCOME TO ROVER!</b></FONT><br><br>
\t <FONT class="subtitletext" color="white" align="center" style="width:
100px;
\t font-size: 30px;">Ready to get started?</FONT><br><br><br>
\t
\t <a href="#"><img src="https://image.ibb.co/nvbiLQ/button.png"
alt="Button" border="0"></a>
\t
\t </TD>
\t </TR>
\t <tr>
\t <td width="80%" bgcolor="#blue" style="width:80%">
\t </td>
\t </tr>
\t </TABLE>
</table>
</div>
答
article {
width: 100%;
}
#banner {
background: url("https://image.ibb.co/dO1HfQ/dog3edit.jpg") no-repeat no-repeat;
padding: 25px 0;
}
h1 {
font-size: 50px;
margin-bottom: 0;
}
h1, p {
color: white;
width: 100%;
text-align: center;
}
p {
font-size: 30px;
}
button {
width: 200px;
background: #00c55c;
border: none;
padding: 12px 24px;
color: white;
font-size: 24px;
border-radius: 6px;
display: block;
margin: 0 auto;
clear: both;
}
#logo {
background: #f2f3f4;
}
#logo img {
display: block;
margin: 0 auto;
clear: both;
}
<article>
<section id="logo">
<img src ="https://image.ibb.co/i4ykZk/roverlogo.png" alt="RoverLogo">
</section> \t
<section id="banner">
<h1>Welcome to Rover!</h1>
<p>Ready to get started?</p>
<button>Search Sitters</button>
</section>
</article>
我做事端像这样。没有布局表格。如果必须内联,只需在HTML块上方放置一个<style></style>
标签即可。
+1
这将是一个网页的理想解决方案。不幸的是,大多数电子邮件服务器会阻止电子邮件中的“正文”部分,所以我使用100%w/h的表格来获取电子邮件的背景颜色。背景颜色假设为灰色。 –
+0
我设置了文章元素的宽度。没有更多的身体标签。 –
kauffee000
答
您使用内联CSS,试试这个:
<TABLE style="width="80%" BORDER="0" cellpadding="0" CELLSPACING="0" align="center"";>
答
对于我使用以下网站的按钮的背景颜色。
我还做了一切分成CSS和HTML,所以你可以看到的。没有内联CSS。这是使用表格和标题的正确方法。
为标头使用<div>
标签,因为它会自动将东西推到后面的新行。不需要中断标签。中断标签很少用于设计中。
另外我确定你的分隔线是蓝色的。
我相信有没有更好的方式来完成这个没有表,但是你说你需要这个表格形式,所以在这里你去!
table {
width: 80%;
border: none;
text-align: center;
margin: 0 auto;
color: white;
}
.background {
background: url('https://image.ibb.co/dO1HfQ/dog3edit.jpg');
}
.titletext {
font-size: 50px;
}
.subtitletext {
font-size: 30px;
}
button {
margin: 10px 0;
width: 50%;
border-radius: 15px;
height: 100px;
background: #27ae60;
border: 1px solid rgba(255,255,255,0.8);
font-size: 20px;
color: white;
}
button:hover {
background-color: #2ecc71;
}
.seperator {
width: 80%;
background: blue;
}
<TABLE>
<TR class="background">
<TD>
<div class="titletext">WELCOME TO ROVER!</div>
<div class="subtitletext">Ready to get started?</div>
<a href="#"><button>Search Sitters</button></a>
</TD>
</TR>
<tr>
<td class="seperator""></td>
</tr>
</TABLE>
+0
我目前有一个表内的表,并需要在style属性中使用内联CSS。有没有办法为多个表定义css? –
+0
在表格标签中使用一个ID。 '
'...然后使用CSS'#tablename'中的id选择器来选择该表。如果使用内联CSS,只需使用style属性即可。 '' –
+0
@RossRhone如果您发现此信息有帮助,请将其标记为答案。不要忘记注册! –
相关问题
-
1. 无法更改TextBoxFor宽度
-
2. 跨度高度宽度无法更改
-
3. 如何更改表格的宽度
-
4. 更改Drupal中表格的宽度?
-
5. 无法更改html列的宽度
-
6. 更改表宽度
-
7. 更改表格宽度动画
-
8. 无法更改弹出宽度
-
9. 无法更改微博按钮宽度
-
10. 当更改网格的宽度时更新矩形的宽度
-
11. 无法更改表格单元格的高度
-
12. 更改表格中的一个单元格的宽度
-
13. 如何更改宽度<th>而不会影响宽度
-
14. 更改VBA中合并表格单元格的宽度(Word 2010)
-
15. 基于动态数字更改表格单元格的宽度
-
16. 固定高度和更改标题宽度(HTML表格)
-
17. CSS更改表格单元格的高度,其中<a>
-
18. 无法修复HTML表格中的单元格宽度
-
19. 我无法调整表格单元格的宽度
-
20. iTextPdf:动态更改单元格宽度
-
21. 如何更改Twitter Bootstrap网格宽度?
-
22. Xcode 6:无法调整textview高度而不更改宽度
-
23. 更改宽度SysIPAddress32
-
24. 如何更改表行的宽度
-
25. Angularjs/jQuery:在ajax调用完成后更改表格的宽度。
-
26. 使用320andup更改表格列的宽度
-
27. 如何更改表格库生成的表格的宽度和颜色?
-
28. 无法使用php variabile设置html表格高度和宽度
-
29. 如何更改表格的列宽
-
30. 更改字体后无法获得最小的datagridview宽度
蓝色表格数据条目不会存在其宽度。有没有一种新的html5方法能够实现这一壮举?该行应该与上面的照片具有相同的宽度。无法更改表格的宽度<TD>
<div class="template" style="text-align:center">
<table width="100%" and height="100%" BORDER=0 CELLSPACING=0 CELLPADDING=0 align="center">
\t \t <tr>
\t \t \t <td width='100%' height='100%' bgcolor='#f2f3f4'>
\t \t \t \t <div style="text-align: center;">
\t \t \t \t \t \t <img src ="https://image.ibb.co/i4ykZk/roverlogo.png" alt="RoverLogo">
\t \t \t \t </div>
\t \t \t </td>
\t \t </tr>
\t
<!-- Background photo -->
\t <TABLE width="80%" BORDER="0" cellpadding="0" CELLSPACING="0" align="center">
\t <TR>
\t <TD WIDTH="997" HEIGHT="326"
background="https://image.ibb.co/dO1HfQ/dog3edit.jpg" style="background-
image:url(https://image.ibb.co/dO1HfQ/dog3edit.jpg); background-repeat:
no-repeat;">
\t <!-- <b>WELCOME TO ROVER! </b> -->
\t <FONT class="titletext" color="white" align="center" style="width: 800px;
\t font-size: 50px;"><b>WELCOME TO ROVER!</b></FONT><br><br>
\t <FONT class="subtitletext" color="white" align="center" style="width:
100px;
\t font-size: 30px;">Ready to get started?</FONT><br><br><br>
\t
\t <a href="#"><img src="https://image.ibb.co/nvbiLQ/button.png"
alt="Button" border="0"></a>
\t
\t </TD>
\t </TR>
\t <tr>
\t <td width="80%" bgcolor="#blue" style="width:80%">
\t </td>
\t </tr>
\t </TABLE>
</table>
</div>
article {
width: 100%;
}
#banner {
background: url("https://image.ibb.co/dO1HfQ/dog3edit.jpg") no-repeat no-repeat;
padding: 25px 0;
}
h1 {
font-size: 50px;
margin-bottom: 0;
}
h1, p {
color: white;
width: 100%;
text-align: center;
}
p {
font-size: 30px;
}
button {
width: 200px;
background: #00c55c;
border: none;
padding: 12px 24px;
color: white;
font-size: 24px;
border-radius: 6px;
display: block;
margin: 0 auto;
clear: both;
}
#logo {
background: #f2f3f4;
}
#logo img {
display: block;
margin: 0 auto;
clear: both;
}
<article>
<section id="logo">
<img src ="https://image.ibb.co/i4ykZk/roverlogo.png" alt="RoverLogo">
</section> \t
<section id="banner">
<h1>Welcome to Rover!</h1>
<p>Ready to get started?</p>
<button>Search Sitters</button>
</section>
</article>
我做事端像这样。没有布局表格。如果必须内联,只需在HTML块上方放置一个<style></style>
标签即可。
这将是一个网页的理想解决方案。不幸的是,大多数电子邮件服务器会阻止电子邮件中的“正文”部分,所以我使用100%w/h的表格来获取电子邮件的背景颜色。背景颜色假设为灰色。 –
我设置了文章元素的宽度。没有更多的身体标签。 – kauffee000
您使用内联CSS,试试这个:
<TABLE style="width="80%" BORDER="0" cellpadding="0" CELLSPACING="0" align="center"";>
对于我使用以下网站的按钮的背景颜色。
我还做了一切分成CSS和HTML,所以你可以看到的。没有内联CSS。这是使用表格和标题的正确方法。
为标头使用<div>
标签,因为它会自动将东西推到后面的新行。不需要中断标签。中断标签很少用于设计中。
另外我确定你的分隔线是蓝色的。
我相信有没有更好的方式来完成这个没有表,但是你说你需要这个表格形式,所以在这里你去!
table {
width: 80%;
border: none;
text-align: center;
margin: 0 auto;
color: white;
}
.background {
background: url('https://image.ibb.co/dO1HfQ/dog3edit.jpg');
}
.titletext {
font-size: 50px;
}
.subtitletext {
font-size: 30px;
}
button {
margin: 10px 0;
width: 50%;
border-radius: 15px;
height: 100px;
background: #27ae60;
border: 1px solid rgba(255,255,255,0.8);
font-size: 20px;
color: white;
}
button:hover {
background-color: #2ecc71;
}
.seperator {
width: 80%;
background: blue;
}
<TABLE>
<TR class="background">
<TD>
<div class="titletext">WELCOME TO ROVER!</div>
<div class="subtitletext">Ready to get started?</div>
<a href="#"><button>Search Sitters</button></a>
</TD>
</TR>
<tr>
<td class="seperator""></td>
</tr>
</TABLE>
我目前有一个表内的表,并需要在style属性中使用内联CSS。有没有办法为多个表定义css? –
在表格标签中使用一个ID。 '
我不认为你想在这里的表。用于创建布局时,表格在语义上并不正确。利用CSS。这将是HTML5的方式。 – kauffee000
我创建的布局将用作电子邮件模板。电子邮件有不同的“语义正确”意义,但你会使用什么样的CSS?我试过使用内联CSS,它似乎没有工作。 –
我在下面更新了我的答案。 – kauffee000