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.

Simple line with CSS

Featured Replies

Afternoon people,

 

Just trying to create a simple line to seperate a heading from a paragraph, just to space things out a bit.

 

Something like the neon green lines on this site http://neon-velo.com/#overview

 

I have a feeling it could be a value of a Border property, but have not yet found it.

 

Any ideas guys?

 

Thanks.

 

 

or you can create an empty <div> with height 1px!

  • 4 weeks later...

toolinfy . com / hrwithcss

 

(Sorry I'm new - I'm not allowed to post "real" links yet...)

This:

 

 

This should do it:

 

p.s. add width as necessary!

hr {
    display:block;
    height:1px;
    border:0;   	
    border-top:1px solid #eeeeee; /* YOUR COLOR HERE */
    margin:1em 0;
    padding:0;
}

 

adding an extra div would work but is unsemantic.

 

if you do need a div to add something such as a background image to the border then just use the css psuedo :after to add in the additional element without screwing with the html source.

The :after pseudo is realy nice to inject markup for layout purposes. It's also used a lot to clear floats. Unfortunately it's not supported by IE7 and below.

EDIT: I would use the hr tag recomended by Robert and Lyndsey

Edited by Nillervision

Lucky for me I decided to ditch developing for IE7 :D

 

I use :after and :before all the time, especially useful for adding css triangles to things like tooltips etc. It's just a shame you can only add the two.

I wish there was a selector like:

 

.className:after[1] { .... }

.className:after[2] { .... }

.className:after[3] { .... }

.className:after[4] { .... }

 

I know it wouldn't be needed so often but cases do prop up where you end up having to add extra divs or spans that are only used for styling and this would solve that.

I tell them that a very limited number of people now use IE7 and it wouldn't be worth the extra cost to them to get me to make their website IE7 compatable.

 

I can also mention that Google have dropped support for IE7 on Gmail and Google Docs so theres not much point in the extra expense to support it.

 

Plus the sooner this browser is dead and buried the better for all of us designers / developers.

Good arguments Robert. I'll keep them in mind. Here in DK there is unfortunately a lot of public institutions like libraries comunity centers ect. that still are using IE7 because they are managed by some Win NT / 2000 security sytems. It's not many machines but they serve a lot of users. I guess Sweden is ahead in that department.

Well actually I haven't really been looking for clients so much in Sweden, I'm looking to get employed with an agency once I have my personnumer. I'm just doing odd small projects sourced from contacts I have abroad. I wouldn't be surprised if I do have to support IE7 again if I am working for an agency :/

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.