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.

Getting creative with CSS Styles

Featured Replies

I have a DIV box that I call a TITLE-STRIP. Its basically used to show a strip of color across the top of a containing DIV, which I then write headings into. My question is this:

 

I use: width: 100%; to make the TITLE-STRIP stretch edge-to-edge inside its containing DIV.

I also need to use padding-left: 6px; on the TITLE-STRIP so that the text inside sits away from the left edge of the DIV.

 

The problem arises here, FF3 hangs the TITLE-STRIP DIV 6px over the right edge of its container when I use this code.

 

So I came up with this:

width: (100%-6px);

Which works beautifully, but, is it bad coding? Or is there a better way to do this that I'm missing?

 

Thanks

 

Jarrad

Hey Jazzy,

 

It's easier than you might think .. you don't have to specify 100% for width (when width is not specified the div will stretch as long as it can - 100% that is).

All you have to do is specify the padding.

  • Author
Hey Jazzy,

 

It's easier than you might think .. you don't have to specify 100% for width (when width is not specified the div will stretch as long as it can - 100% that is).

All you have to do is specify the padding.

 

Hi Mihai,

 

Thanks for your reply. I thought there must be something I was missing :) problem fixed, no fuss!

 

(interesting how CSS can accept and process equations, I was not aware of this until I tried it)

 

Much appreciated for your help,

 

Jarrad

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.