472,954 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 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 7558
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.