cece.indiana.edu如何在我的代码中的移动菜单上的标题栏中放置文本?
移动菜单工作得很好;但是,我似乎无法弄清楚如何在标题栏中添加文本。在汉堡菜单的右边,我想要文字。我将如何做到这一点?我已经花了大约一小时的这个小小的新手,但似乎无法弄清楚! image of the title bar
cece.indiana.edu如何在我的代码中的移动菜单上的标题栏中放置文本?
移动菜单工作得很好;但是,我似乎无法弄清楚如何在标题栏中添加文本。在汉堡菜单的右边,我想要文字。我将如何做到这一点?我已经花了大约一小时的这个小小的新手,但似乎无法弄清楚! image of the title bar
该tric将使用float: left
。这里的CSS:
CSS
#titleBar .toggle {
height: 60px;
left: 0;
position: relative; /*to make the float work*/
top: 0;
width: 80px;
z-index: 2;
float: left; /*the magic*/
}
#titleBar .title {
display: block;
position: relative;
letter-spacing: 2px;
line-height: 44px;
font-size: 1.3em;
font-weight: 700;
text-align: left; /*possibly what you meant*/
text-transform: uppercase;
color: #fff;
z-index: 1;
float: left; /*the magic*/
}
浮动使浮动跨度彼此相邻,解决你的问题。希望这会有所帮助!
我改了一下我的代码。虽然它没有显示在在线网页上,但是通过创建一个ID为“logo”并将其命名为CECE的html元素,我可以在标题栏中显示CECE。但是,当我这样做时Google Chrome会将网页识别为移动网页,并且只会显示移动网页。我的CSS中没有任何内容可以说明这一点,并且可以在其他浏览器中使用。我清除了缓存,并且非常困惑。 – Curb
这是奇特的。我可以看到这个版本的代码吗? –
我只是说这在Chrome控制台,但增加了该位后<span class="toggle"
<span class="toggle-right-title">Text</span>
那么CSS应该是这样的
.toggle-right-title {
margin-left: 35px;
font-size: 20px;
color: #fff;
font-weight: bold; }
您可以更改和自定义这是需要的话
所以你想要的文字是在汉堡旁边,而不是在现在的中间? –