Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Navigation bar is weak

Featured Replies

Okay so I've disabled zoom and am using percentages for all the design and EM for fonts.

 

Look at the difference between the first and second picture.

 

Info: The grey is the html background color, blue is header (the navigation bar (pink) is also in header), green is the main divider where all my html files will be opened, yellow is the footer.

 

I tried media queries and box-sizing:border-box. Neither worked.

 

http://snag.gy/FE5w4.jpg

 

http://snag.gy/Nivja.jpg

Instead of just using em for font's try using Relative EM, rem. When the initial font size is changed by the media query all other size statements will respond to the new base size.

 

To be able to help you more though we will need to see your css for the nav bar.

  • Author


So i need to understand more about media queries and use rem

*{
margin:0;
border:0;
padding:0;
}

html{
font-size:100%;
background-color:grey;
}

body{
}

a{
text-decoration:none;
color:black;
background-color:#FFFFFF;
}

header{
height:18.75%;
width:100%;
background-color:blue;
}

header h1{
margin:0;
font-size:2.617924em;
text-align:center;
}

#firstNav, #secondNav{
width:100%;
margin-top:3.187%;
background-color:black;
}

#firstNav ul, #secondNav ul{
list-style-type:none;
}

#firstNav ul li, #secondNav ul li{
height:9.375%;
width:20%;
float:left;
font-size:1.618em;
background-color:pink;
}

#firstNav ul li a, #secondNav ul li a{
background-color:#black;
}

#main{
background-color:green;
}

footer{
background-color:yellow;
}

 

Edited by legg92

Media queries van take a little getting used too, but yes understanding them will enable your layout to become responsive.

 

Your html has a font-size of '100%', if you changed that to 16px it would make all browsers use the same size as the basis for calculating your text sizes and help with cross browser compatibility.

 

Then in your header h1 you have a font-size of '2.617924em', simply changing that to 2.617924rem would them also help with cross browser compatibility as well as making it easier to scale. When you do the math using rem as the unit of measure and having the html font-size set to 16px that is 41.886784px high.

 

Another trick you can use is instead of using percentages for your margins and padding around text use the rem again as this will keep the negative space in balance with the text size. for instance in your id firstnav, id secondnav you have margin-top at 3.187%, if that was 0.5rem you would know that your spacing is going to be 8px. You would need to calculate how much space to use and then convert that to the rem value though which does take a little practice. Then using the percentages for margins and padding on the outer containers will ensure everything fills the page you want it to as long as things have both minimum and maximum sizes if their physical size is important to the way your design looks.

 

Then each break point for responsive layout you can also use the same scaling to ensure things will look the way you intend.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.