如何在标题中的电话号码旁边放置电子邮件

时间:2019-02-03 23:32:40

标签: html css

我需要帮助,以使电子邮件链接成为我的徽标元素的一部分。我希望它位于我的电话号码链接的右侧。我所包含的图片是我想要的外观。但是,当您向下滚动时,CSS会导致徽标反转颜色。您在该照片中看到的电子邮件链接不会以相同的方式响应,因为我创建了第二个div来使其不受挫折地包含其中。但是我无法让第二个div表现出相同的行为,我尝试过包含相同的CSS类,等等。当我尝试在徽标div中添加电子邮件锚标记时,它们位于彼此的顶部。

长话短说,我只想将电子邮件添加到徽标div中,然后将其放置在右侧。实际上,它始终位于电话号码的同一行。

Here's a picture of how it should look

这是我的HTML

<!-- Header -->
<header class="header header-fixed header-fixed-on-mobile header-transparent" data-bkg-threshold="100">
    <div class="header-inner">
        <div class="row nav-bar">
            <div class="column width-12 nav-bar-inner">
                <div class="logo">
                    <div>
                        <a href="tel:1-530-680-8255" style="color: grey"><i class="fas fa-phone display:inline-block"></i> 1-530-680-8255</a>   
                        <a href="tel:1-530-680-8255"><i class="fas fa-phone" style="display:inline-block"></i> 1-530-680-8255</a>
                    </div>
                </div>
                <div class="logoemail">
                    <div>
                        <a href="mailto:#"> <i class="fas fa-envelope"></i></i> <strong>lwallaceconstruction@gmail.com</strong> </a>
                    </div>
                </div>

                                <nav class="navigation nav-block secondary-navigation nav-right">
                                    <ul>
                                        <li class="aux-navigation hide">
                                            <!-- Aux Navigation -->
                                            <a href="#" class="navigation-show side-nav-show nav-icon">
                                                <span class="icon-menu"></span>
                                            </a>
                                        </li>
                                    </ul>
                                </nav>
                                <nav class="navigation nav-block primary-navigation nav-center">
                                    <ul>

                                        <li class="current"><a href="index.html">Home <i class="fas fa-home"></i></a></li>
                                        <li class="current"><a href="index.html">About <i class="fas fa-at"></i></a></li>
                                        <li class="current"><a href="index.html">Services <i class="fas fa-wrench"></i> </a></li>
                                        <li class="current"><a href="index.html">Contact <i class="fas fa-phone"></i> </a></li>


                                    </ul>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </div>
</header>
<!-- Header End -->

这是CSS

/* Initial Logo Width */
.header .logo{
    font-size: 12px;
    width: 900px;
    top: 0px;
    left: -40px;
    position: absolute;
}

.logoemail {
    font-size: 12px;
    width: 400px;
    top: 30px;
    left: 100px;
    position: absolute;
    color: 
}

/* Compacted Header Logo Width */
.header-compact .logo{
    width: 800px;

}

/* Initial Logo Styling */
.header .logo a{
    display: block !important;
    position: absolute;
    top: 0;
}
.header-in .logo a,
.header-out .logo a{
    -webkit-transition-duration: 0ms;
    transition-duration: 0ms;
}
.header .logo a:first-child{
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}
.header .logo a + a{
    display: none !important;
}

/* Transparent Header Show Light Logo */
.header-transparent .logo a:first-child{
    opacity: 0;
    -webkit-transform: translateY(5rem);
    transform: translateY(5rem)
}
.header-transparent .logo a + a{
    display: block !important;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

/* Header Background Logo Swap to Dark Logo - On Scroll! */
.header-background .logo a:first-child{
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}
.header-background .logo a + a{
    display: block !important;
    opacity: 0;
    -webkit-transform: translateY(-5rem);
    transform: translateY(-5rem);
}

/* Logo Nav Dark */
.nav-dark .logo a:first-child{
    display: block !important;
    top: 0;
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}
.nav-dark .logo a:last-child{
    display: none !important;
}

/* Logo Mobile Header & Breakpoints */
.mobile .header .logo a:first-child{
    display: block !important;
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}
@media only screen and (max-width: 960px){
    .header .logo-inner{
        display: table-cell;
        vertical-align: middle;
    }
    .header .logo a{
        position: relative;
    }
    .header .logo a:first-child{
        opacity: 1;
        top: 0;
        -webkit-transform: translateX(0) !important;
        transform: translateX(0) !important;
    }
    .header .logo a:last-child{
        display: none !important;
    }
}

1 个答案:

答案 0 :(得分:0)

使用

display: inline-block;

因此元素将保持一致。