473,394 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

width of bottom-border?

By width, I don't mean weight. I have a row of <li>'s, with a
bottom-border. I want the bottom-border to only go 90% of the <li>
(centered)

Is there any way to do this?

I have it in this format:

CSS:
li {
border-bottom: 1px solid #00ff00;
}
HTML:
<ul>
<li>this</li>
<li>that</li>
<li>the other</li>
<li>bleh</li>
</ul>

Oct 31 '06 #1
16 3260


On Oct 30, 4:18 pm, "FuzzyLogik" <taw...@gmail.comwrote:
By width, I don't mean weight. I have a row of <li>'s, with a
bottom-border. I want the bottom-border to only go 90% of the <li>
(centered)

Is there any way to do this?

I have it in this format:

CSS:
li {
border-bottom: 1px solid #00ff00;

}HTML:
<ul>
<li>this</li>
<li>that</li>
<li>the other</li>
<li>bleh</li>
</ul>
!Also!

On the same list, when I have items rollover, it's not padding out like
the first line, e.g.:
|---This is a list item----|
|---This is a list item----|
|---This is a list item----|
|---This is a list item----|
|---This is a longer-------|
|List item-------------------|

I want it all to be padded out 6px.

Oct 31 '06 #2
In article
<11*********************@i42g2000cwa.googlegroups. com>,
"FuzzyLogik" <ta****@gmail.comwrote:

is it not time for you to post a url?

--
dorayme
Oct 31 '06 #3

dorayme wrote:
In article
<11*********************@i42g2000cwa.googlegroups. com>,
"FuzzyLogik" <ta****@gmail.comwrote:

is it not time for you to post a url?

--
dorayme
http://www.phazm.net/csstest/list01.html

Well, I don't know what I was doing wrong at work, but now the one that
wraps around is being padded correctly, so forget that :)

But I want the green bottom-border to NOT touch the blue border,
WITHOUT pushing the blue border out any more than 200px (which it's at
currently)

Oct 31 '06 #4
On 2006-10-31, FuzzyLogik <ta****@gmail.comwrote:
>
dorayme wrote:
>In article
<11*********************@i42g2000cwa.googlegroups .com>,
"FuzzyLogik" <ta****@gmail.comwrote:

is it not time for you to post a url?

--
dorayme

http://www.phazm.net/csstest/list01.html

Well, I don't know what I was doing wrong at work, but now the one that
wraps around is being padded correctly, so forget that :)

But I want the green bottom-border to NOT touch the blue border,
WITHOUT pushing the blue border out any more than 200px (which it's at
currently)
Make the <lia bit narrower, and use margin instead of padding on the
left.

This works because padding goes inside the border, margin goes outside
it.

i.e. where you have

li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}

try

li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}
Oct 31 '06 #5

Ben C wrote:
On 2006-10-31, FuzzyLogik <ta****@gmail.comwrote:

dorayme wrote:
In article
<11*********************@i42g2000cwa.googlegroups. com>,
"FuzzyLogik" <ta****@gmail.comwrote:

is it not time for you to post a url?

--
dorayme
http://www.phazm.net/csstest/list01.html

Well, I don't know what I was doing wrong at work, but now the one that
wraps around is being padded correctly, so forget that :)

But I want the green bottom-border to NOT touch the blue border,
WITHOUT pushing the blue border out any more than 200px (which it's at
currently)

Make the <lia bit narrower, and use margin instead of padding on the
left.

This works because padding goes inside the border, margin goes outside
it.

i.e. where you have

li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}

try

li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}

Great, thank you :)

Oct 31 '06 #6
Ben C wrote:
On 2006-10-31, FuzzyLogik <ta****@gmail.comwrote:
>http://www.phazm.net/csstest/list01.html

Well, I don't know what I was doing wrong at work, but now the one
that wraps around is being padded correctly, so forget that :)

But I want the green bottom-border to NOT touch the blue border,
WITHOUT pushing the blue border out any more than 200px (which it's
at currently)

Make the <lia bit narrower, and use margin instead of padding on
the left.

This works because padding goes inside the border, margin goes
outside it.

i.e. where you have

li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}

try

li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}
Perhaps this will be a bit better, allowing the centering Fuzzy
originally mentioned, and also scaling when a visitor resizes:

ul {
padding:0;
margin:0;
list-style-type:none;
width:20%; /* size to taste */
border:1px solid #3399FF;
}
li {
margin: 0 5%; /* <-- makes width of border-bottom 90% */
border-bottom:1px solid #33FF00;
text-align: center; /* <-- as originally requested */
}

--
-bts
-Motorcycles defy gravity; cars just suck
Oct 31 '06 #7


On Oct 31, 5:38 am, "Beauregard T. Shagnasty"
<a.nony.m...@example.invalidwrote:
Ben C wrote:
On 2006-10-31, FuzzyLogik <taw...@gmail.comwrote:
>http://www.phazm.net/csstest/list01.html
Well, I don't know what I was doing wrong at work, but now the one
that wraps around is being padded correctly, so forget that :)
But I want the green bottom-border to NOT touch the blue border,
WITHOUT pushing the blue border out any more than 200px (which it's
at currently)
Make the <lia bit narrower, and use margin instead of padding on
the left.
This works because padding goes inside the border, margin goes
outside it.
i.e. where you have
li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}
try
li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}Perhaps this will be a bit better, allowing the centering Fuzzy
originally mentioned, and also scaling when a visitor resizes:

ul {
padding:0;
margin:0;
list-style-type:none;
width:20%; /* size to taste */
border:1px solid #3399FF;}li {
margin: 0 5%; /* <-- makes width of border-bottom 90% */
border-bottom:1px solid #33FF00;
text-align: center; /* <-- as originally requested */

}--
-bts
-Motorcycles defy gravity; cars just suck

Ahh, now that I'm at work and see my code again, it becomes a bit more
complicated.

#nav {
width: 138px;
background-color: #FFF;
padding:1em 0 1em 0;
}

#nav ul {
list-style: none;
padding: 0 0 13px 0;
margin: 0 0 1em 0;
border: none;
background-color: #00FF00;
}

#nav li {
padding-left:6px;
margin: 0;
border-right: 1px solid #669fb7;
border-left: 1px solid #669fb7;
background-color: #F0F9FE;
border-bottom: 1px solid #C5D3DD;
}

So I can't actually adjust the size of the li, because that will make
the border on the left not align with the border on the top. (makes it
shallower)

Oct 31 '06 #8


On Oct 31, 7:14 am, "FuzzyLogik" <taw...@gmail.comwrote:
On Oct 31, 5:38 am, "Beauregard T. Shagnasty"

<a.nony.m...@example.invalidwrote:
Ben C wrote:
On 2006-10-31, FuzzyLogik <taw...@gmail.comwrote:
>>http://www.phazm.net/csstest/list01.html
>Well, I don't know what I was doing wrong at work, but now the one
>that wraps around is being padded correctly, so forget that :)
>But I want the green bottom-border to NOT touch the blue border,
>WITHOUT pushing the blue border out any more than 200px (which it's
>at currently)
Make the <lia bit narrower, and use margin instead of padding on
the left.
This works because padding goes inside the border, margin goes
outside it.
i.e. where you have
li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}
try
li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}Perhaps this will be a bit better, allowing the centering Fuzzy
originally mentioned, and also scaling when a visitor resizes:
ul {
padding:0;
margin:0;
list-style-type:none;
width:20%; /* size to taste */
border:1px solid #3399FF;}li {
margin: 0 5%; /* <-- makes width of border-bottom 90% */
border-bottom:1px solid #33FF00;
text-align: center; /* <-- as originally requested */
}--
-bts
-Motorcycles defy gravity; cars just suckAhh, now that I'm at work and see my code again, it becomes a bit more
complicated.

#nav {
width: 138px;
background-color: #FFF;
padding:1em 0 1em 0;

}#nav ul {
list-style: none;
padding: 0 0 13px 0;
margin: 0 0 1em 0;
border: none;
background-color: #00FF00;

}#nav li {
padding-left:6px;
margin: 0;
border-right: 1px solid #669fb7;
border-left: 1px solid #669fb7;
background-color: #F0F9FE;
border-bottom: 1px solid #C5D3DD;

}So I can't actually adjust the size of the li, because that will make
the border on the left not align with the border on the top. (makes it
shallower)
That was confusing, here's an html file:

http://www.phazm.net/csstest/list1b.html

Oct 31 '06 #9
On 2006-10-31, FuzzyLogik <ta****@gmail.comwrote:
[snip]
li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}
try
li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}Perhaps this will be a bit better, allowing the centering Fuzzy
originally mentioned, and also scaling when a visitor resizes:

ul {
padding:0;
margin:0;
list-style-type:none;
width:20%; /* size to taste */
border:1px solid #3399FF;}li {
margin: 0 5%; /* <-- makes width of border-bottom 90% */
border-bottom:1px solid #33FF00;
text-align: center; /* <-- as originally requested */
[snip]
Ahh, now that I'm at work and see my code again, it becomes a bit more
complicated.

#nav {
width: 138px;
background-color: #FFF;
padding:1em 0 1em 0;
}

#nav ul {
list-style: none;
padding: 0 0 13px 0;
margin: 0 0 1em 0;
border: none;
background-color: #00FF00;
}

#nav li {
padding-left:6px;
margin: 0;
border-right: 1px solid #669fb7;
border-left: 1px solid #669fb7;
background-color: #F0F9FE;
border-bottom: 1px solid #C5D3DD;
}

So I can't actually adjust the size of the li, because that will make
the border on the left not align with the border on the top. (makes it
shallower)
Sorry, don't understand. What border on the top? The li has no top
border.
Oct 31 '06 #10


On Oct 31, 7:27 am, Ben C <spams...@spam.eggswrote:
On 2006-10-31, FuzzyLogik <taw...@gmail.comwrote:
[snip]
li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}
try
li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}Perhaps this will be a bit better, allowing the centering Fuzzy
originally mentioned, and also scaling when a visitor resizes:
ul {
padding:0;
margin:0;
list-style-type:none;
width:20%; /* size to taste */
border:1px solid #3399FF;}li {
margin: 0 5%; /* <-- makes width of border-bottom 90% */
border-bottom:1px solid #33FF00;
text-align: center; /* <-- as originally requested */
[snip]
Ahh, now that I'm at work and see my code again, it becomes a bit more
complicated.
#nav {
width: 138px;
background-color: #FFF;
padding:1em 0 1em 0;
}
#nav ul {
list-style: none;
padding: 0 0 13px 0;
margin: 0 0 1em 0;
border: none;
background-color: #00FF00;
}
#nav li {
padding-left:6px;
margin: 0;
border-right: 1px solid #669fb7;
border-left: 1px solid #669fb7;
background-color: #F0F9FE;
border-bottom: 1px solid #C5D3DD;
}
So I can't actually adjust the size of the li, because that will make
the border on the left not align with the border on the top. (makes it
shallower)Sorry, don't understand. What border on the top? The li has no top
border.
It has an image border, not CSS.
The blue border obviously needs to match up everywhere, while the
"underline" should not touch it, but be about 3-4px off on each side

Oct 31 '06 #11
On 2006-10-31, FuzzyLogik <ta****@gmail.comwrote:
>

On Oct 31, 7:27 am, Ben C <spams...@spam.eggswrote:
>On 2006-10-31, FuzzyLogik <taw...@gmail.comwrote:
[snip]
li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}
try
li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}Perhaps this will be a bit better, allowing the centering Fuzzy
originally mentioned, and also scaling when a visitor resizes:
>ul {
padding:0;
margin:0;
list-style-type:none;
width:20%; /* size to taste */
border:1px solid #3399FF;}li {
margin: 0 5%; /* <-- makes width of border-bottom 90% */
border-bottom:1px solid #33FF00;
text-align: center; /* <-- as originally requested */
[snip]
Ahh, now that I'm at work and see my code again, it becomes a bit more
complicated.
#nav {
width: 138px;
background-color: #FFF;
padding:1em 0 1em 0;
}
#nav ul {
list-style: none;
padding: 0 0 13px 0;
margin: 0 0 1em 0;
border: none;
background-color: #00FF00;
}
#nav li {
padding-left:6px;
margin: 0;
border-right: 1px solid #669fb7;
border-left: 1px solid #669fb7;
background-color: #F0F9FE;
border-bottom: 1px solid #C5D3DD;
}
So I can't actually adjust the size of the li, because that will make
the border on the left not align with the border on the top. (makes it
shallower)Sorry, don't understand. What border on the top? The li has no top
border.

It has an image border, not CSS.
The blue border obviously needs to match up everywhere, while the
"underline" should not touch it, but be about 3-4px off on each side
I see, the problem is that your <li>s also have left and right borders,
which you don't want to move.

You could move the left and right borders from the <li>s to the ul; but
that spoils your curved edges at the bottom. You can fix that by instead
of making the curved image the background-image of the <uljust make
it an <img style="display: block"that follows the ul (and transfer the
ul's bottom margin to that img as well).

Alternatively, since there is no problem in CSS which cannot be solved
by using another level of nesting, you can put inside your <li>s spans
with left and right margins. Then transfer the bottom borders from the
<li>s to the nested spans. Obviously the content goes in the span, i.e.

<li><span>This is a test</span></li>

Both of these solutions compromise the "logic" of your HTML by adding
extra elements, but I can't see a way of getting the exact effect you
want without doing that.

It's easy if you either lose the curved borders, or allow the bottom
borders to go all the way the edge.

There is one further alternative which is to get rid of the bottom
border altogether and use text-decoration: underline. Not exactly the
same effect, but fairly similar.
Oct 31 '06 #12
FuzzyLogik wrote:
The blue border obviously needs to match up everywhere, while the
"underline" should not touch it, but be about 3-4px off on each side
See my post where it says:

margin: 0 5%; /* <-- makes width of border-bottom 90% */

--
-bts
-Motorcycles defy gravity; cars just suck
Oct 31 '06 #13
On 2006-10-31, Beauregard T. Shagnasty <a.*********@example.invalidwrote:
FuzzyLogik wrote:
>The blue border obviously needs to match up everywhere, while the
"underline" should not touch it, but be about 3-4px off on each side

See my post where it says:

margin: 0 5%; /* <-- makes width of border-bottom 90% */
That was a good suggestion for a solution to the original problem. But
now the OP wants a box that looks like this:

| _____ |

where | is left and right borders, and _ is bottom border.

i.e. gaps between the left and right ends of the bottom border and the
left and right borders.

This can't be done per se, so any solution is likely to involve the
left/right borders and bottom border being on different boxes.
Oct 31 '06 #14
Ben C wrote:
That was a good suggestion for a solution to the original problem. But
now the OP wants a box that looks like this:
Oh. I missed where Fuzzy changed the parameters ...
"When you come to the fork in the road, take it."

-Yogi Berra

--
-bts
-Motorcycles defy gravity; cars just suck
Oct 31 '06 #15


On Oct 31, 9:01 am, Ben C <spams...@spam.eggswrote:
On 2006-10-31, FuzzyLogik <taw...@gmail.comwrote:


On Oct 31, 7:27 am, Ben C <spams...@spam.eggswrote:
On 2006-10-31, FuzzyLogik <taw...@gmail.comwrote:
[snip]
li {
padding-left:13px;
border-bottom:1px solid #33FF00;
width: 200px;
}
try
li {
/* padding-left:13px; */
margin-left: 13px;
border-bottom:1px solid #33FF00;
width: 174px;
}Perhaps this will be a bit better, allowing the centering Fuzzy
originally mentioned, and also scaling when a visitor resizes:
ul {
padding:0;
margin:0;
list-style-type:none;
width:20%; /* size to taste */
border:1px solid #3399FF;}li {
margin: 0 5%; /* <-- makes width of border-bottom 90% */
border-bottom:1px solid #33FF00;
text-align: center; /* <-- as originally requested */
[snip]
Ahh, now that I'm at work and see my code again, it becomes a bit more
complicated.
#nav {
width: 138px;
background-color: #FFF;
padding:1em 0 1em 0;
}
#nav ul {
list-style: none;
padding: 0 0 13px 0;
margin: 0 0 1em 0;
border: none;
background-color: #00FF00;
}
#nav li {
padding-left:6px;
margin: 0;
border-right: 1px solid #669fb7;
border-left: 1px solid #669fb7;
background-color: #F0F9FE;
border-bottom: 1px solid #C5D3DD;
}
So I can't actually adjust the size of the li, because that will make
the border on the left not align with the border on the top. (makes it
shallower)Sorry, don't understand. What border on the top? The li has no top
border.
It has an image border, not CSS.
The blue border obviously needs to match up everywhere, while the
"underline" should not touch it, but be about 3-4px off on each sideI see, the problem is that your <li>s also have left and right borders,
which you don't want to move.

You could move the left and right borders from the <li>s to the ul; but
that spoils your curved edges at the bottom. You can fix that by instead
of making the curved image the background-image of the <uljust make
it an <img style="display: block"that follows the ul (and transfer the
ul's bottom margin to that img as well).

Alternatively, since there is no problem in CSS which cannot be solved
by using another level of nesting, you can put inside your <li>s spans
with left and right margins. Then transfer the bottom borders from the
<li>s to the nested spans. Obviously the content goes in the span, i.e.

<li><span>This is a test</span></li>

Both of these solutions compromise the "logic" of your HTML by adding
extra elements, but I can't see a way of getting the exact effect you
want without doing that.

It's easy if you either lose the curved borders, or allow the bottom
borders to go all the way the edge.

There is one further alternative which is to get rid of the bottom
border altogether and use text-decoration: underline. Not exactly the
same effect, but fairly similar.
Alright, thanks for your help :-/

I guess I'm just going to leave them touching the border, as I need to
keep the code logical (I'm trying to convince my boss that tables are
not the way to go in this instance, and I just got done giving him my
speal on semantic coding, so I can't go and throw in a bunch of extra
stuff like that.

Let it be noted that I fully support adding a "length" and "height"
value to borders.
;)

Oct 31 '06 #16
On 2006-10-31, FuzzyLogik <ta****@gmail.comwrote:
[snip]
>Both of these solutions compromise the "logic" of your HTML by adding
extra elements, but I can't see a way of getting the exact effect you
want without doing that.

It's easy if you either lose the curved borders, or allow the bottom
borders to go all the way the edge.
[snip]
I guess I'm just going to leave them touching the border, as I need to
keep the code logical (I'm trying to convince my boss that tables are
not the way to go in this instance, and I just got done giving him my
speal on semantic coding, so I can't go and throw in a bunch of extra
stuff like that.
Good decision. Much better to be a bit flexible about what it looks like
than go crazy trying to control the last pixel. And good to stick to the
principle of not introducing bogus elements purely for layout purposes.
And good to lecture the boss.
Let it be noted that I fully support adding a "length" and "height"
value to borders.
;)
Personally I think life is quite complicated enough already.
Oct 31 '06 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Glabbeek | last post by:
I'm changing the layout of my site. Instead of using tables, I will use DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not the correct width. Mozilla and Opera are showing the...
2
by: Tristan Miller | last post by:
Greetings. I have a two-column web layout, where the first column is just the regular body text with a "marign-right" of 16em, and the second column is an "absolute"-positioned div with a width...
8
by: Harlan Messinger | last post by:
I created a page, currently viewable at http://mywebpages.comcast.net/hmessinger/cssbuttons1.html that displays a couple of buttons simulated with styles applied to <span> tags. The buttons...
8
by: Dave Cook | last post by:
Hi I would like to create a table that uses the whole width of IE. I have set the table width to 100% and the right margin to 0 on the document but still the table is displayed about 50 pixels...
1
by: | last post by:
Hi, I'm trying to right-align a context menu with its source control. Here's what I have to LEFT align it: '\\\ Dim pt As New Point(0, myButton.Height) myContextMenu.Show(myButton, pt) '///
2
by: kudryk | last post by:
Is it possible through javascript to determine the width of a rendered table cell? I have two adjacent tables, one on top of the other. Both tables have the same number of columns, because the...
1
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the Width of the ImageMap below. The problem is that the ImageMap's Width doesn't have any effect in my GridView, the width are determine by width of the...
5
by: Taras_96 | last post by:
Hi everyone, Can anyone tell me why the top paragraph block stretches across the screen (as you would expect), while the bottom div doesn't stretch across the entire screen? When I set the width...
3
by: Sven C. Koehler | last post by:
Hello, the html below displays a box (#container) with a #footer and an #image inside. Is there any way how I could get rid of declaring max-width and max-height for the #image? The #image...
5
by: DDubya | last post by:
Hello, Site: http://www.dryleague.com/newDefault.htm CSS: http://www.dryleague.com/css/style.css I'm trying align the date to the bottom-right of my "header" div. The "header" div has a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.