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.

css margin question

Featured Replies

hey all.

 

if you take a look at a site im working on, www.changemyworkout.com, im trying to have the div with color code #0066FF stretch the length of the body, adding 10 or 15 px to the top, right, and left. i cant seem to figure it out :( thanks in advance.

 

peace and love.

 

mike

are you wanting to get rid of the margins if so it is because browsers have automatic padding and margins, if you add this to your css it should help

 

 

html, body {margin:0; padding0;}

  • Author
:) perfect. now im trying to get the banner down 10px, but when i try it brings the background with it. i just want the banner to shift 10px down within the top background. thanks again for the quick reply.
  • Author

scratch that. theres gotta be a correct way to get the banner down 15 or 20px. what do you think?

#how about

 

.banner {
 margin-top:15px;
}

  • Author

i had tried that earlier, i have it in now and as you can see it pulls down the whole div with it. i want it to move down but have the top stay the same color.

In the topbackground css add padding-top:15px; instead of having the margin...also its best to keep all your style info in the style sheet instead of starting to style inline as well, you have a perfectly nice css sheet you should use it :pp (just because it will make editing easier later on and its good practice to keep the style info out the html :) )

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.