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.

Word spacing in css

Featured Replies

Hello, me again.

 

What I want to know is if it is possible to position one word in a ul li.

I can sort the margin for the other words but I just want to centre the Products.

 

Cheers

 

Stuey

 

post-41093-0-14903100-1363873249_thumb.png

Add a class to the list element e.g.

 

<li class="products"> Products </li>

 

Then use CSS to center the text:

 

li.products  { text-align: center; }

Lyndsey.

  • Author

I did a span class to change the colour, could I do the text-align in that?

You can only do it with a <span> tag if the element is set to display:block; like this:

 

<span class="center"> Centered text </span>

.center {
   display:block;
   text-align:center;
}

 

This is because a <span> is an inline element so text-align:center; will work off the elements content width (e.g. the width of the text inside the span). However, a block element takes its width off it's container (in this case the <span> element), so the text will move to the middle of the container.

 

Alternatively, use a block-level element like a <div>, which will work without using display:block inside the CSS (as it's display:block by default).

 

Hope I made sense :p

Lyndsey

  • Author

Crystal clear. Thank you

  • Author

Boom! Thank you very much, again ha ha

 

Finished result.

post-41093-0-87946600-1363876399_thumb.png

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.