Jump to content

ordered list


simpli

Recommended Posts

Expanding on fry2010's post, you might try this:

 

Supposing your ordered list has a div that wraps it with a  class of myOrderedList...

 

.myOrderedList {

    float: left;

    width: 500px;

}

 

.myOrderedList ol{

    float: left;

}

 

.myOrderedList li{

    float: left;

    width: 100px;

}

.myOrderedList input{

    width: 100px;

}

 

 

What I'm doing there is floating everything (but the input) to the left since that sort of attaches it all together and any border or bg you might put on that div wrapper will fit nicely, instead of sliding up under the ordered list.

 

The div has a width of 500px which can fit 5 input's/li's.

 

If you add any padding/margin/border to either the ol/li/input, you'll have to increase the 500px width on the div wrapper.

 

Link to comment
Share on other sites

Excuse my newbness but I am not familiar with the .xyz format. How should i declare it in the css and how should I use it in the html?

 

for example how would I use this?

.myOrderedList {

    float: left;

    width: 500px;

}

Link to comment
Share on other sites

that . represents a 'class'

 

You know there are two types of css declerations yeah? They are id and class.

You call id once in your page and is represented as such:  <p id="my_id">

You can call a class multiple times on a page as such:  <p class="my_class">

 

The in your style sheet you have:

for the id:  #my_id { ..... }

for the class:  .my_class { ...... }

 

For the above class you have .myOrderedList { ....}

You need to place this in the html element you want to have these attributes as such:

<ol class="myOrderedList">

 

If you are going to use Floydians example you still need to use the

display: inline;

attribute in your

.myOrderedList li { ..... }

 

So looks like this:

 

.myOrderedList li{

float: left;

width: 100px;

display: inline;

}

 

Both methods will do what you require.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.