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.

:after and :before, help!?

Featured Replies

Right this was just a basic test, I know if this works then i can apply backgrounds and curved corners etc

so here is my code,

 
img { border-left: 1px solid #DDDDD3; border-right: 1px solid #DDDDD3; width: 60px; margin: 5px auto; }
img:before { border-top: 1px solid #DDDDD3; height: 1px; width: 60px; content: ' '; font-size: 1px; }
img:after { border-bottom: 1px solid #DDDDD3; height: 1px; width: 60px; content: ' '; font-size: 1px; }

content: ' '; is to make the sections appear, without anything as content they won't appear even if you put a height on it.

 

The thing is this works with any element like <h1> or <pre> etc, but this won't work with anything like <img> or <input>, so i'm assuming for elements like <img> and <input> it won't work or am I missing something?

 

Please help me :D, thankyou.

<img> and <input> are inline elements and as such they do not break the flow of the page. Block elements like <div> and <h1> will span the full width available to them. <img> (inline element) cannot be given a margin because margins can only be given to block elements.

 

Try wrapping inline elements in a block element like a <div> or giving inline elements a property of {display:block;}

  • Author
<img> and <input> are inline elements and as such they do not break the flow of the page. Block elements like <div> and <h1> will span the full width available to them. <img> (inline element) cannot be given a margin because margins can only be given to block elements.

 

Try wrapping inline elements in a block element like a <div> or giving inline elements a property of {display:block;}

 

Thanks for the quick reply, the {display:block;} idea failed i'm afraid, it looks like wrapping it inside a <div> tag will have to be the option, I was trying to avoid it, but oh well :D, Thankyou.

No probs. I forgot to mention that MS browsers < IE8 do not properly interpret before and after pseudo classes.

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.