3

h2 aホバー時に 6pxが適用されたフローティングタグがありborder-topます。テキストにカーソルを合わせると、テキストとその下の要素が押し下げられます。境界線がテキストやその他の要素を動かないようにするにはどうすればよいですか? ありがとう!

私の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 {
  border: 0;
  font-size: 100%;
  font: inherit;
  margin: 0;
  padding: 0
}

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: none
}

table {
  border-collapse: collapse;
  border-spacing: 0
}

.container {
  width: 960px;
  margin: 0px auto;
}

.logo {
  float: left;
  clear: both;
  margin-top: 30px;
}

body {
  background-image: url("../images/bg.jpg");
  border-top: 8px solid black;
}

h2 a {
  font-family: arial;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 94px;
  color: black;
  float: right;
  margin: 0px;
  padding-top: 20px;
}

h2 a:hover {
  border-top: 6px solid orange;
  padding-top: 0px;
}

.clocknotes {
  width: 437px;
  margin: 0px auto;
  clear: both;
}

.brand-three {
  clear: both;
  margin-top: 85px;
}

.brand-three {
  font-size: 200px;
  line-height: 140px;
  float: left;
  letter-spacing: -20px;
}

.quote {
  clear: both;
  width: 417px;
  float: right;
  text-align: right;
  margin-top: -250px;
  font-size: 26px;
}

.social {
  clear: both;
  float: right;
  margin-top: -80px;
}

.footer {
  clear: both;
  top: 50px;
  position: relative;
}
4

3 に答える 3

15

CSS:

h2 a:hover {
    border-top: 6px solid orange;
    padding-top:14px;

}

デモ: http://jsfiddle.net/rathoreahsan/VyRZW/

于 2012-06-25T04:11:03.463 に答える
2

上部パディングをゼロではなく、同じ量だけ減らします。

h2 a:hover {
border-top: 6px solid orange;
padding-top: 14px;
}
于 2012-06-25T04:06:56.297 に答える
0

このコードを与えます:

h2 a {border-top: 6px solid #fff;} /* Should match your background color */
于 2012-06-25T03:54:04.243 に答える