getting a <p> to have a fixed width regardless of content

L

libsfan01

hi all

i know this isnt the right place to post a css thing but i dont know
any other good forums to post to.

what im trying to do is get a paragraph tag to display like a textbox
but put links in there which can be clicked on. (so a textbox wont
work). i want each <p> to have the same length (regardless of link
length) so they line up ok when placed in rows.

is this possible?

here is my styling so far of the <p> :

style='padding:none;margin:0; display:inline; width:100px;'

this gets the p on the same line as the other stuff (which i want) but
can get the width to work?!

regards

Marc
 
R

RobG

libsfan01 said:
hi all

i know this isnt the right place to post a css thing but i dont know
any other good forums to post to.
news:comp.infosystems.www.authoring.stylesheets


what im trying to do is get a paragraph tag to display like a textbox
but put links in there which can be clicked on. (so a textbox wont
work). i want each <p> to have the same length (regardless of link
length) so they line up ok when placed in rows.

is this possible?

No. The width property does not apply to inline elements.

<URL: http://www.w3.org/TR/CSS21/visudet.html#q4 >

[...]
 
L

libsfan01

No. The width property does not apply to inline elements.

ive tried changing it to span too and applying a block to the display
but this just sends it to a new line. is there some way of getting a
kind of 'block-inline' display whereby width is adhered to but display
is online and extra content is missed off, like a textbox but readonly
so that a link is clickable?

any help would be greatly appreciated :)
 
R

Richard Cornford

Rik said:
Well, a good thing <p> is a block then. Apply width freely.

As the OP is applying:-

| style='padding:none;margin:0; display:inline; width:100px;'

- (and disregarding the fact that 'none' is not a valid value for
padding) to the P element its display style becomes inline and the
width value does not apply to it.

Richard.
 
L

libsfan01

As the OP is applying:-
| style='padding:none;margin:0; display:inline; width:100px;'

- (and disregarding the fact that 'none' is not a valid value for
padding) to the P element its display style becomes inline and the
width value does not apply to it.


Not valid is it? seems to work fine for me. so anyway ive changed
'none' to '0' and it still dont work :-(
 
R

RobG

libsfan01 said:
ive tried changing it to span too and applying a block to the display
but this just sends it to a new line. is there some way of getting a
kind of 'block-inline' display whereby width is adhered to but display
is online and extra content is missed off, like a textbox but readonly
so that a link is clickable?

any help would be greatly appreciated :)

Ask in a CSS news group as indicated in my first reply.
 
R

RobG

Rik said:
Hehe, my bad, that will teach me to read the original post instead of just
the answer :)

I'll cop some of that, I shouldn't have trimmed the relevant line.
 
M

Matt Kruse

libsfan01 said:
what im trying to do is get a paragraph tag to display like a textbox
but put links in there which can be clicked on. (so a textbox wont
work). i want each <p> to have the same length (regardless of link
length) so they line up ok when placed in rows.

<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 1</p>
<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 2</p>
<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 3</p>
<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 4</p>
 
L

libsfan01

<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 1</p>
<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 2</p>
<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 3</p>
<p style="padding:0;margin:0;width:100px;float:left;border:1px solid
black;">Content 4</p>

ive tried your idea matt but it doesnt work i think bcos the other
elements on each 'row' arent floated left which is something that isnt
possible as it would corrupt the design already in place.

is it possible to get a text box to display active hyperlinks?
 
L

libsfan01

Ive gone the 'ugly' table root i think its the only way to get the
right spacing between elements on a single line :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top