473,890 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
16 3297


On Oct 31, 7:27 am, Ben C <spams...@spam. eggswrote:
On 2006-10-31, FuzzyLogik <taw...@gmail.c omwrote:
[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.c omwrote:
>

On Oct 31, 7:27 am, Ben C <spams...@spam. eggswrote:
>On 2006-10-31, FuzzyLogik <taw...@gmail.c omwrote:
[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>Thi s 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.*********@ex ample.invalidwr ote:
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.c omwrote:


On Oct 31, 7:27 am, Ben C <spams...@spam. eggswrote:
On 2006-10-31, FuzzyLogik <taw...@gmail.c omwrote:
[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>Thi s 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.c omwrote:
[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
13965
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 page the way I want. Does anybody know a solution for this? First of all, the code I am using: CSS ------- body {
2
4485
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 of 16em. I would like to have a footer extending across the entire width of the page, at the very bottom of the page (i.e., after both columns end). How can I do this? There is no way of knowing in advance which of the two columns will be...
8
1996
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 have two classes applied to them, one of which has the sole effect of setting a fixed width of 125px. Then I added a DOCTYPE tag at the top of the file. In IE6, this killed the width and padding on the buttons, as seen at
8
1582
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 short of the window edge. Can anybody help me ? Thanks.
1
1784
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
24488
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 content of each column in the top table is related to the its corresponding column in the bottom table (I needed to use two tables because of the UI I had to design). Depending on the size of the numbers in the bottom table's columns, each individual...
1
2008
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 column and the with of the div (the div the ImageMap is included in). In the code below the column & div has Width of 300px and ImageMap has Width of 130, but when the page holding this GridView is displayed then the Width is 300 on the ImageMap. I...
5
11030
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 to 100% (which I interpret as saying 'make this width the same width as the parent (which is the entire screen)) the div is made just wide enough to fit it's contents, and if I decrease the value for the width, the width of the div stretches?!
3
3540
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 should fill up all the space left in the #container. <html><head></head><body><style type="text/css"> #image { max-width: 200px; max-height: 90px; } #container { position: fixed; width: 200px;
5
4194
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 padding of 5px all around. I was able to align the "headerDate" div to the bottom of the container, however, since I couldn't align right, I decided to make it width:100% and text-align:right. In FF3 & IE7, the "headerDate" div extends past the...
0
9977
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10802
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10910
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10452
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9618
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7161
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4667
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3268
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.