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.

small CSS problem

Featured Replies

Im creating a html/css form, and i want to have those little red astrixes which show which fields are neccessary.

Heres my code at the moment:

 

<style type = 'text/css'>

.redastrix
{
color:red;
}

</style>

 

 

Then later on:

 

<strong>Forename:</strong>
<div class = 'redastrix'>*</div>
...

 

Cheers in advance

What's your actual question?

 

Anyway here's the correct markup for a form field...

 

<label for="idname">My fieldname <span class="redasterix">*</span></label><input id="idname" type="text" name="fieldname" />

.redastrix {
color:red;
}

No need for them spans

 

<label for="idname">My fieldname <strong>*</strong></label><input id="idname" type="text" name="fieldname" />

label strong {
color:red;
}

Marking up the astrix with strong emphasize makes more semantic sence.

 

Avoid class names indicating layout. If you where to use a span with class names for asterix' use instead

<span class="astrix">

That way the class name doesn't imply a certain colour. If you where to redesign your site, or make a handheld or print stylesheet the astrix might not be red and the class name would not make sense.

 

 

 

Anyway, what was your question? ;)

  • Author

Cheers, the problem that i was having was that it was going to a new line each time there was an astrix, but i think that was because i was using div tags instead of span tags

 

Cheers! :D :D :D

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.