表行比父div表宽

时间:2015-10-15 12:04:18

标签: html css

你知道如何扩大表格行比他的父表更广泛吗?

我希望底部的按钮有点狂野,所以它会压倒桌子的边框。

enter image description here

我是否必须忘记桌面风格?

如果你想知道它是如何完成的,那么这是一个 JsFiddle

HTML

<div id="topDest"><!-- display:table -->
  <h2>DESTINATIONS PREFEREES</h2>
  <ul>
    <li><a href="/voyage/asie/chine/">Circuit Chine</a></li>
    <li><a href="/voyage/europe/corse/">Circuit Corse</a></li>
    ...
  </ul>
  <a href="/dernieres-minutes.html">DERNIERES MINUTES</a><!-- display:table-row -->
</div>

3 个答案:

答案 0 :(得分:1)

在CSS中对此进行更改,它会工作..

#topDest > a {
    background: rgba(0, 0, 0, 0) linear-gradient(135deg, #ff9c00 0%, #ef7f09 35%) repeat scroll 0 0;
    color: #ffffff;
    display: block;
    line-height: 30px;
    margin: 0 -3px -3px;
    padding: 0 3px;
    text-align: center;
    width: 100%;
}

答案 1 :(得分:0)

这有点棘手

使用以下

更新您的css
#topDest > a{
    display:inline-block; 
    width:104%;
    margin: 0 auto;
    color:#ffffff;
    line-height:30px;

    background: #ff9c00;
    background: -moz-linear-gradient(-45deg, #ff9c00 0%, #ef7f09 35%);
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#ff9c00), color-stop(35%,#ef7f09));
    background: -webkit-linear-gradient(-45deg, #ff9c00 0%,#ef7f09 35%);
    background: -o-linear-gradient(-45deg, #ff9c00 0%,#ef7f09 35%);
    background: -ms-linear-gradient(-45deg, #ff9c00 0%,#ef7f09 35%);
    background: linear-gradient(135deg, #ff9c00 0%,#ef7f09 35%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff9c00', endColorstr='#ef7f09',GradientType=1 );
    text-align: center;

    position:relative;
    left:-5px;
    right:-5px;
}

此处是更新的 jsFiddle

答案 2 :(得分:0)

我只更新了这个:

#topDest > a{
  display:block; /* updated */
  /* delete : width:100%;*/
  margin: 0 -10px; /* added, adjust this value */
  /* ... */
}

结果:

/* Reset CSS*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}


.container{
    width:30%;
    margin: 0 auto;
}
#topDest{
    display:table;
	width: 100%;
	border:3px #39a9dc solid;
}
#topDest *{
    text-decoration:none;
    font-family: 'Helvetica Neue'
}
#topDest > a{
    display:block;  
    /*width:100%;*/
	margin: 0 -10px;
	color:#ffffff;
    line-height:30px;
    
    background: #ff9c00;
    background: -moz-linear-gradient(-45deg, #ff9c00 0%, #ef7f09 35%);
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#ff9c00), color-stop(35%,#ef7f09));
    background: -webkit-linear-gradient(-45deg, #ff9c00 0%,#ef7f09 35%);
    background: -o-linear-gradient(-45deg, #ff9c00 0%,#ef7f09 35%);
    background: -ms-linear-gradient(-45deg, #ff9c00 0%,#ef7f09 35%);
    background: linear-gradient(135deg, #ff9c00 0%,#ef7f09 35%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff9c00', endColorstr='#ef7f09',GradientType=1 );
	text-align: center;
}

#topDest > a:hover{
    background: #39a9dc;
    background: -moz-linear-gradient(-45deg, #39a9dc 0%, #1686b9 35%);
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#39a9dc), color-stop(35%,#1686b9));
    background: -webkit-linear-gradient(-45deg, #39a9dc 0%,#1686b9 35%);
    background: -o-linear-gradient(-45deg, #39a9dc 0%,#1686b9 35%);
    background: -ms-linear-gradient(-45deg, #39a9dc 0%,#1686b9 35%);
    background: linear-gradient(135deg, #39a9dc 0%,#1686b9 35%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#39a9dc', endColorstr='#1686b9',GradientType=1 );
}

#topDest ul{
	background:#ffffff;
	padding: 0;
  	margin-left: 15px;
}
#topDest li{
    line-height:1.5;
    font-size:14px;
}
#topDest ul li a{
	color:#000000;
}
#topDest h2{
    background: #39a9dc;
    background: -moz-linear-gradient(-45deg, #39a9dc 0%, #1686b9 35%);
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#39a9dc), color-stop(35%,#1686b9));
    background: -webkit-linear-gradient(-45deg, #39a9dc 0%,#1686b9 35%);
    background: -o-linear-gradient(-45deg, #39a9dc 0%,#1686b9 35%);
    background: -ms-linear-gradient(-45deg, #39a9dc 0%,#1686b9 35%);
    background: linear-gradient(135deg, #39a9dc 0%,#1686b9 35%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#39a9dc', endColorstr='#1686b9',GradientType=1 );
	color: #ffffff;
	font-size: 0.9em;
	text-align: center;
	margin: 0;
	padding: 10px 0;
}
<div class="container">&nbsp;
<div id="topDest" class="destRight">
  <h2>DESTINATIONS PREFEREES</h2>
  <ul>
    <li><a href="/voyage/asie/chine/">Circuit Chine</a></li>
    <li><a href="/voyage/asie/birmanie/">Circuit Birmanie</a></li>
    <li><a href="/voyage/europe/corse/">Circuit Corse</a></li><!--
    <li><a href="/voyage/europe/italie/">Circuit Italie</a></li>
    <li><a href="/voyage/oceanie/australie/">Circuit Australie</a></li>
    <li><a href="/voyage/ameriques/etats-unis/miami/">Circuit Floride</a></li>
    <li><a href="/voyage/ameriques/argentine/">Circuit Argentine</a></li>
    <li><a href="/voyage/ameriques/bresil/">Circuit Brésil</a></li>
    <li><a href="/voyage/asie/cambodge/">Circuit Cambodge</a></li>-->
    <li><a href="/voyage/europe/norvège/">Circuit Norvège</a></li>
    <li><a href="/voyage/europe/espagne/seville/">Circuit Andalousie</a></li>
  </ul>
  <a href="/dernieres-minutes.html">DERNIERES MINUTES</a>
</div>
</div>

相关问题