473,396 Members | 2,010 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,396 software developers and data experts.

CSS for All Elements (Bullets <UL> <LI>) Without <DIV ID="">

Hello!

I have a quick question regarding CSS and having it applied to all
elements. I am trying to eliminate the gap between a paragraph and a
list that usually occurs in html and I've found away to do that with
this code:

<p>a</p>
<ul style="margin-top: -20; padding-top: 0">
<li>1</li>
</ul>

However I was hoping to use CSS to do it to all elements and without
using <DIV id="">. Here is an example of the CSS code I have so far,
but you need to use <div id="squish"> around them.

<style type="text/css">
#squish {
width: 10em;
}
#squish ul {
margin-left: 1em;
margin-top: -20;
padding-top: 0;
padding-left: 0;
}
</style>

Is there a way to apply this to all bullets <UL> <LI> on the page
using CSS without having to use <div id="">?

Thanks for your help!

Shaun
Jul 23 '05 #1
2 7608
in comp.infosystems.www.authoring.html, Shaun wrote:
Hello!

I have a quick question regarding CSS and having it applied to all
elements.
Then why are you asking here? alt.html where you asked first is good also
for CSS, but this group is only for HTML. There is
comp.infosystems.www.authoring.stylesheets for CSS.
I am trying to eliminate the gap between a paragraph and a
list that usually occurs in html and I've found away to do that with
this code:

<p>a</p>
<ul style="margin-top: -20; padding-top: 0">
<li>1</li>
</ul>
Which is wrong, as pointed out for you in alt.html
However I was hoping to use CSS to do it to all elements and without
using <DIV id="">.
Then why are you using div with id?
Here is an example of the CSS code I have so far,
but you need to use <div id="squish"> around them. [snip]

Go look for selectors in CSS
Is there a way to apply this to all bullets <UL> <LI> on the page
using CSS without having to use <div id="">?


Most likely, but I fail to understand your question.

ul {background:red;}

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Jul 23 '05 #2
Shaun wrote:
Hello!

I am trying to eliminate the gap between a paragraph and a
list .....


I guess that you have to understand that P and LISTS are blocks and that
blocks provide double 'line leading/breaks/line returns' as a
conventional default. This is done by the browser with a default
margin-bottom and margin-top. (The double line leadings for both are
collapsed to only one double line leading.)

In order to eliminate the double line leading, the margin-bottom for the
preceding Paragraph must be set to zero and the margin-top for the
subsequent List must be set to zero.

--
Gus
Jul 23 '05 #3

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

Similar topics

13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
4
by: Akbar | last post by:
All, I'm currently using an alt attribute in a div tag to store "keywords" for a function that will show or hide certain div's based on a given keyword. Is there a better (standard) place to put...
3
by: Jordan Peterson | last post by:
When using {list-style: none} to hide the bullets in a <ul>, the bullets disappear but they are still accounted-for when positioning text. Specifically, I have: <div style='text-align:...
3
by: Jim in Arizona | last post by:
Most of the asp.net learning I've done has been from books that were written during the 1.0 framework. I didn't have a copy of visual studio when I started reading them then I got a hold of VS 2005...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
1
by: mark4asp | last post by:
<form runat="server"automatically adds <divtag to code contained within. Is there a way to stop that? Mixing block-level elements with inline-level elements messes up the HTML becasuse that is...
5
by: chakradhari.ashish | last post by:
Does anybody know how can I load an html page inside a <div</div> where the content gets update on the onclick even of anchor <a href=> </a>? I googled around and followed some links pointing me...
1
by: msg2ajay | last post by:
hi, i am working on <div> i have to hide some part of the table. I am not able to hide that table part can anybady tell me where is the error. <html> <head> <script...
6
by: capricious | last post by:
Is it possible, so that when you do multiple <UL>'s to control how deep the UL's are marked? For example, it would defaultly look like this with multiple ULs and LIs: -- Code : Main...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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...

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.