html - 对齐导航中的 Logo 并粘贴标题?

标签 html css layout navigation

如何垂直对齐 Logo 旁边的导航?但是logo和nav的响应式设计不会输。 My site

像这样:

enter image description here

这是我当前导航的演示

Codepen

Logo 的 CSS

 #masthead .site-branding{ 
float: left; 
padding: 15px 0;
}
#masthead .site-branding img{
height: auto !important;
width: auto !important;
display: block;
}

最佳答案

您发送的图片显示您的导航位置正确,但响应大小有问题。是吗?

j查询:

$(document).ready(function(){
   window_height = $(window).height();
   if(window_height<500) {   //you should adjust that the function run in an appropriate size of window
       //here you can write that your logo and navigation div doesn't have any float so that each of them place in a line. for example:
       $("#logo").css("float" , "none");
       $("#navigation").css("float" , "none");
   }
});

或者 css:

@media screen and (max-width: 800px) {  */ when the size of screen got smaller than 800px*/
    */your css*/
}

并注意将此标记添加到您的头部:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

关于html - 对齐导航中的 Logo 并粘贴标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26333840/

相关文章:

android - 从文件中读取对象会抛出 IllegalAccessException

javascript - <body>.onLoad 是在渲染完成之前调用的吗?

html - 将父 div 包裹在 float 元素周围

css - Vue 组件中的响应式 Prop

css 1、css 2、css 2.1 和 css 3,每个版本中哪些 css 属性和选择器不同/新增?

html - 如何使用 Twitter Bootstrap 创建类似 Facebook 的工具提示布局?

Css float 调整布局

javascript - 如何将此菜单变成多级菜单?

javascript - 我如何判断 HTML 元素是否正在屏幕上呈现?

html - 如何在支持打印的同时模拟背景图像