- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我希望我的 btn 类向右移动。我有两个按钮类,例如。 btn-full, btn-ghost, 我想把它们都向右移动,如果我把它向右浮动,它们的位置就会改变,我不知道为什么。
<head>
<link rel="stylesheet" type="text/css" href="vendors/css/normalize.css">
<link rel="stylesheet" type="text/css" href="vendors/css/grid.css">
<link rel="stylesheet" type="text/css" href="resources/css/style.css">
<link href='https://fonts.googleapis.com/css?family=Lato:400,100,300,300italic' rel='stylesheet' type='text/css'>
<title>Musica</title>
</head>
<body>
<header>
<div class="hero-text-box">
<h1>Life is the Song.<br> Love is the Music.</h1>
<a class= "btn btn-full" href="#">Listen </a>
<a class="btn btn-ghost" href="#">Show me more</a>
</div>
</header>
</body>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html{
background-color: #fff;
color: #555;
font-family: 'Lato','Arial',sans-serif;
font-weight: 300px;
font-size: 20px;
text-rendering: optimizeLegibility;
}
.row{
max-width: 1140px;
margin: 0 auto;
}
header{
background-image:linear-gradient(rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8)),url(img/hero.jpg);
background-size: cover;
background-position: center;
height: 100vh;
}
.hero-text-box{
position: absolute;
width: 1140px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
h1{
float: right;
margin: 0;
margin-bottom: 20px;
color: #fff;
font-size: 240%;
font-weight: 300;
text-transform: uppercase;
letter-spacing: 1px;
word-spacing: 4px;
}
.btn:link,
.btn:visited{
display: inline-block;
padding: 10px 30px;
font-weight: 300;
text-decoration: none;
border-radius: 200px;
color: #fff;
transition: background-color 0.2s, border 0.2s, color 0.2s;
margin-top: 150px;
}
.btn-full:link,
.btn-full:visited{
background-color: #2ecc71;
border: 1px solid #2ecc71;
color: #fff;
margin-right: 15px;
}
.btn-ghost:link,
.btn-ghost:visited{
border: 1px solid #2ecc71;
color: #2ecc71;
}
.btn:hover,
.btn:active{
background-color: #1e874b;
}
.btn-full:hover,
.btn-full:active{
border: 1px solid #1e874b;
}
.btn-ghost:hover,
.btn-ghost:active{
border: 1px solid #1e874b;
color: #fff;
}
我尝试了所有的方法,比如 float:right, the position:absolute; ;左:-5oo;但它不起作用。请帮忙
最佳答案
也许你想要这样的东西?
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html{
background-color: #fff;
color: #555;
font-family: 'Lato','Arial',sans-serif;
font-weight: 300px;
font-size: 20px;
text-rendering: optimizeLegibility;
}
.row{
max-width: 1140px;
margin: 0 auto;
}
header{
background-image:linear-gradient(rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8)),url(img/hero.jpg);
background-size: cover;
background-position: center;
height: 100vh;
}
.hero-text-box{
position: absolute;
width: 1140px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align:right;
}
h1{
margin: 0;
margin-bottom: 20px;
color: #fff;
font-size: 240%;
font-weight: 300;
text-transform: uppercase;
letter-spacing: 1px;
word-spacing: 4px;
}
.btn:link,
.btn:visited{
display: inline-block;
padding: 10px 30px;
font-weight: 300;
text-decoration: none;
border-radius: 200px;
color: #fff;
transition: background-color 0.2s, border 0.2s, color 0.2s;
}
.btn-full:link,
.btn-full:visited{
background-color: #2ecc71;
border: 1px solid #2ecc71;
color: #fff;
margin-right: 15px;
}
.btn-ghost:link,
.btn-ghost:visited{
border: 1px solid #2ecc71;
color: #2ecc71;
}
.btn:hover,
.btn:active{
background-color: #1e874b;
}
.btn-full:hover,
.btn-full:active{
border: 1px solid #1e874b;
}
.btn-ghost:hover,
.btn-ghost:active{
border: 1px solid #1e874b;
color: #fff;
}
</style>
<body>
<header>
<div class="hero-text-box">
<div><h1 style="display:inline-block; text-align:left;">Life is the Song.<br> Love is the Music.</h1></div>
<a class= "btn btn-full" href="#">Listen </a>
<a class="btn btn-ghost" href="#">Show me more</a>
</div>
</header>
</body>
实验:
.btn:link,
.btn:visited{
display: inline-block;
padding: 10px 30px;
font-weight: 300;
text-decoration: none;
border-radius: 200px;
color: #fff;
transition: background-color 0.2s, border 0.2s, color 0.2s;
margin-top: 150px;
}
上边距:150px;//你试图用我建议的这条线手动放置按钮,如果你调整按钮的位置你可以逃脱它,但这是一个不好的做法。
相反,我只是命令 div 使其内容右对齐,并将 H1 放在 div 中,然后将 H1 向左对齐以获得完美的左对齐文本。
关于html - 想要 Div 向右移动,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33291338/
有没有人知道那里有预览@page CSS 规则的工具?如果做不到这一点,有什么东西可以用来打印完全支持这些规则的文档吗? http://www.w3.org/TR/CSS2/page.html 歌剧最
出于某种原因,当我向我的元素添加右/左浮动时,它会在下一行的图像元素后面显示它们。 这是实际的事件页面: http://www.dealerbyte.co.uk/used-cars.php 代码如下:
我想知道是否可以使用下面的 onTouch 方法来检测用户是否在屏幕上向左、向右、向上或向下移动手指。我有一个包含对象的网格,我只希望用户能够在四个方向上移动其中一个对象。 我的想法是使用 Actio
我想获取div的鼠标坐标,如下所示: $("#box").mousemove(function(e){ var x = e.pageX - this.offsetLeft; var y = e.pag
到目前为止,我有一个可以左右前后移动的玩家,但是我如何设置它是向前的,就像在网格上一样向前,而不是在我的玩家注视的地方向前。我将相机设置为 FPS,它跟随玩家。现在我想让玩家能够使用我的 MouseL
在水平时间轴 slider jquery 中,我希望默认情况下它是右向的。就像现在的图片,2015 年的价格就在右边。我希望默认选择最右边的 2017 年价格,用户可以向左滚动 我的代码 $('.ti
我正在尝试为纸牌游戏(Yu-Gi-Oh :D)制作一个牌组管理器,目前我只有一个包含可用纸牌的表格和一个面板,该面板以更大的尺寸显示用户选择的纸牌以及纸牌的描述。MVCE: import ja
我有一个从简单手势扩展的类,我正在使用 onfling 方法: class MyGestureListener extends GestureDetector.SimpleOnGestureListe
我很懒惰,讨厌每 5 秒就必须将右手移到箭头键或鼠标上来移动光标和编辑文本。有什么方法可以让我的手保持在打字位置并四处移动光标? 最佳答案 您可以在特定的首选项窗口中更改这些设置: windows -
这是我的第一个应用程序,我尝试进行从右到左或从左到右的翻译。 这是代码 Res > anim > translate_left Res > anim > translate_right
我有以下代码: out of bound :( 我不希望它穿过 window 。我需要它的右边框保持可见。 JSFiddle 链接:http://jsfiddle.net/9SZAB/ 最佳答案
我正在尝试让我的导航图标菜单按钮在 THIS IS A LOGO Home About
因为我自己的代码有问题,所以我正在研究以下链接: https://bost.ocks.org/mike/path/ 我想我已经低于 // push a new data point onto the
所以首先这就是我要实现的目标 我想保持 Logo 在网页中间居中,搜索栏向右拉(下面有文字)这是我目前拥有的代码: http://jsfiddle.net/62b4jf1n/
这个问题在这里已经有了答案: Android: How to handle right to left swipe gestures (22 个回答) 关闭4个月前。 我有一个 Android 应用程
我正在尝试创建一个控件,用户可以在该控件中触摸并移动框架内的按钮。这是我的代码。 - (void)wasDragged:(UIButton *)button withEvent:(UIEvent *)
我正在使用svg创建一个几何campass工具,其中有3个btns,1) 用于移动位于中心的整个营地2) 增加圆的半径3)用于旋转圆的半径4)根据第4个btn的位置使用路径(svg)绘制圆,该位置始终
无论分辨率如何,我都试图将此框移到屏幕的右侧,但我找不到答案。 我的代码是这样的 wp_get_archives( array( 'type' => 'postbypost',
我正在为 Qt 按钮小部件编写弹出菜单。每当单击按钮时,都会弹出一个菜单(在按钮下方)。 弹出菜单默认位于下方左侧。 有没有办法让弹出菜单在按钮下方的右侧弹出? 没有设置位置功能,所以我想知道是否有一
我正在尝试使用 jQuery 构建一个扫雷游戏,我成功地使用 event.which 处理了左右点击,但是是否可以同时检测到左右按钮的点击? 最佳答案 我怀疑你是否会同时获得两者,一次会先出现,即使相
我是一名优秀的程序员,十分优秀!