简体   繁体   English

并排对齐两个锚

[英]Aligning two anchors side by side

Here is an image of my current progress: 这是我当前进度的图片:

在此处输入图片说明

As you can see, the anchors are aligining themselves incorrectly.They should be equidistanct from eachother and aligned symmetrically. 如您所见,这些锚定点自身定位不正确,它们应彼此等距并对称对齐。

What am I doing incorrectly that I need to be doing to get the two anchor elements to align correctly left to right, having the right anchor pushed up obviously. 我做错了什么,我需要做些什么才能使两个锚点元素从左到右正确对齐,从而使右锚点明显向上推。

I'd prefer to not have to alter the positioning 我宁愿不必更改位置

 a.genericbuttonleft { position: static; margin: 0px; //float:left; } a.genericbuttonright { position: static; margin: 52%; //float:right; } .profileinfo { position: relative; background-color: #202020; box-sizing: border-box; padding: 20px 20px 25px 20px; -webkit-overflow-scrolling: touch; } .profileinfo h1 { font: 40px/45px'HelveticaNeue-Light', sans-serif-light; color: #ffffff; margin: 0; } .profileinfo a { position: absolute; right: 30px; top: 34px; display: block; width: 260px; box-sizing: border-box; padding: 18px 0 16px 0; font: 25px/25px'-apple-system', BlinkMacSystemFont, 'HelveticaNeue', Roboto; text-decoration: none; text-align: center; text-transform: uppercase; color: #ffffff; background-color: #13cc3a; border: 0; border-radius: 5px; margin: 10px auto; overflow: hidden; } 
 <div class="profileinfo"> <h1><!-- this needs to stay here even though not being used --></h1> <a class="genericbuttonleft">Search Profiles</a> <a class="genericbuttonright">Create a Profile</a> </div> 

Here you go 干得好

 a.genericbuttonleft { margin: 0px; left: 0; } a.genericbuttonright { right: 0; } .profileinfo { position: relative; background-color: #202020; box-sizing: border-box; padding: 20px 20px 25px 20px; -webkit-overflow-scrolling: touch; } .profileinfo h1 { font: 40px/45px'HelveticaNeue-Light', sans-serif-light; color: #ffffff; margin: 0; } .profileinfo a { position: absolute; top: 34px; display: block; width: 260px; box-sizing: border-box; padding: 18px 0 16px 0; font: 25px/25px'-apple-system', BlinkMacSystemFont, 'HelveticaNeue', Roboto; text-decoration: none; text-align: center; text-transform: uppercase; color: #ffffff; background-color: #13cc3a; border: 0; border-radius: 5px; margin: 10px auto; overflow: hidden; } 
 <div class="profileinfo"> <h1><!-- this needs to stay here even though not being used --></h1> <a class="genericbuttonleft">Search Profiles</a> <a class="genericbuttonright">Create a Profile</a> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM