10 replies [Last post]
mike27
Offline
newbie
Last seen: 13 years 45 weeks ago
Joined: 2007-09-10
Posts: 5
Points: 0

Hi.
I want to create a simple link with css border around it. here is the code.
It works just fine under firefox, but doesn't under IE 6 and 7.
In those 2 browsers I can see only the left and right border, why?

a title


Some sample text

Mike.

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 4 years 2 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

Work on getting your code

Work on getting your code valid, and don't use inline styles.
Once this is done, and you still have issues we will help from there.

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

mike27
Offline
newbie
Last seen: 13 years 45 weeks ago
Joined: 2007-09-10
Posts: 5
Points: 0

sorry... here is the valid

sorry...
here is the valid code:
st.css

.mm {
margin-top:20px;
text-align:center;
width: 95%;
}

.lin {
text-decoration:none;
border: #000000 solid 2px;
}

the xhtml file:

a title


Some sample text

I want the border to be only around the text...
It works on firefox, but not on IE.

Mike.

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 4 years 2 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

I would suggest putting a

I would suggest putting a <p> around the text, to help make it semantically correct, and then applying border: 2px solid #000; to the <p>

lemme know if that works.

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

mike27
Offline
newbie
Last seen: 13 years 45 weeks ago
Joined: 2007-09-10
Posts: 5
Points: 0

It works, but not like I

It works, but not like I want it to.
With the border style applied to the <p>, the border is not just around the text but it has width of the div that surrounds it, and I need this div to set the width of the layer...

Mike.

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 4 years 2 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

Have you TRIED setting a

Have you TRIED setting a width to the <p> tag?

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

mike27
Offline
newbie
Last seen: 13 years 45 weeks ago
Joined: 2007-09-10
Posts: 5
Points: 0

The thing is, I don't know

The thing is, I don't know the width bacause the text is created dynamicly.
Mike.

Deuce
Deuce's picture
Offline
Guru
Somewhere, USA
Last seen: 4 years 2 weeks ago
Somewhere, USA
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4424
Points: 1843

haven't tried it, but does

haven't tried it, but does width: auto; work?

all » http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 21 weeks 3 days ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

I can't replicate your

I can't replicate your issue. In all browsers tested, Firefox, Konqueror, IE6 and Opera, the text was properly bordered.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

mike27
Offline
newbie
Last seen: 13 years 45 weeks ago
Joined: 2007-09-10
Posts: 5
Points: 0

I've tried it on IE6 and

I've tried it on IE6 and IE7, Firefox, Safari, Opera and it doesn't work on IE6 and IE7...
You're saying that you could see border all around the text in IE6 when you copied my code?

Mike.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 21 weeks 3 days ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Yep. cheers, gary

Yep.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.