在视差图像上书写文字

时间:2017-07-05 15:13:55

标签: html css image parallax

好的,所以我创建了一个使用视差滚动的图像。

代码是:

<head><style>
/*Parallax*/
.hpimg1 { 


    /* Set a specific height */
    height: 540px; 

    /* Create the parallax scrolling effect */
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    padding-left: 0px;
}
.hpimg1
{    /* The image used */
    background-image: url("bg.jpg");
}

.welcome
{
  height: 200px;
  background-color: #fff;
  word-wrap: normal;
  word-break: keep-all;
  font-family: 'Montserrat';
  font-weight: 700;
  font-size: 31px;
  line-height: 1.125em;
  margin-right: 0;
  margin-left: 0;
  margin-bottom: 0;
  box-sizing: border-box;
  top: 300px;
}
h5
{   
  color:white;
  top: 300px; 
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  padding-bottom: 38px;
  -webkit-margin-before:0.67em;
  -webkit-margin-after:0.67em;
  -webkit-margin-start:0px;
  -webkit-margin-end:0px;
  -webkit-tap-highlight-colour:rgba(0,0,0,0);
  -webkit-font-smoothing:antialiased;
  -webkit-box-direction:normal;
}
h5:after, h5:before
{
  content: '';
  width: 50px;
  height: 2px;
  background: black;
  margin: 0 10px;
}</style
</head>
<body>
<div class="hpimg1"><div class="Welcome"><h5>Welcome to RyanTeaches</h5></div></div>
</body

问题在于,出于某种原因,我的消息“欢迎使用RyanTeaches”卡在导航栏后面的页面顶部。 (仅包含视差滚动+消息的相关代码)

我尝试了很多东西,top:300;,margin-top,padding-top等尝试将此消息向下移动,但它仍然保留在页面顶部,隐藏在导航栏后面。

此外,当我尝试将代码移动到我的.css样式表时,视差图像隐藏在所有内容之后,并且在屏幕上不可见?

新编码员 - 任何帮助将不胜感激!

干杯

1 个答案:

答案 0 :(得分:0)

您可以向Highcharts.chart('container', { chart: { polar: true }, title: { text: 'Highcharts Polar Chart' }, pane: { startAngle: 0, endAngle: 360 }, xAxis: { tickInterval: 45, min: 0, max: 360, labels: { formatter: function () { return this.value + '°'; } } }, yAxis: { min: 0 }, plotOptions: { series: { pointStart: 0, pointInterval: 45 } }, series: [{ type: 'areaspline', name: 'Area spline', data: [1, 2, 3, 4, 5, 6, 7, 8] }, { type: 'area', name: 'Area', data: [1, 8, 2, 7, 3, 6, 4, 5] }] }); 添加一些flexbox属性:

.Welcome
/*Parallax*/

.hpimg1 {
  /* Set a specific height */
  height: 540px;
  /* Create the parallax scrolling effect */
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  padding-left: 0px;
}

.hpimg1 {
  /* The image used */
  background-image: url("https://placehold.it/200x200");
}

.welcome {
  height: 200px;
  background-color: #fff;
  word-wrap: normal;
  word-break: keep-all;
  font-family: 'Montserrat';
  font-weight: 700;
  font-size: 31px;
  line-height: 1.125em;
  margin-right: 0;
  margin-left: 0;
  margin-bottom: 0;
  box-sizing: border-box;
  top: 300px;
}

.Welcome {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
}

h5 {
  color: white;
  top: 300px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  padding-bottom: 38px;
  -webkit-margin-before: 0.67em;
  -webkit-margin-after: 0.67em;
  -webkit-margin-start: 0px;
  -webkit-margin-end: 0px;
  -webkit-tap-highlight-colour: rgba(0, 0, 0, 0);
  -webkit-font-smoothing: antialiased;
  -webkit-box-direction: normal;
}

h5:after,
h5:before {
  content: '';
  width: 50px;
  height: 2px;
  background: black;
  margin: 0 10px;
}

相关问题