473,796 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table layout using CSS

Hi everyone. I'm trying to emulate a simple table layout using CSS only.
This hyperlink (http://homepage.ntlworld.com/r.morris7/tabledemo.htm) shows
the intended result, which I've knocked up using a table.

Please note a couple of things. The second line of text in the right-hand
columns don't wrap beneath the italic heading. The first column contains a
heading (of sorts, not an actual <hx> element) that is aligned to the right.

Any help would be much appreciated!

Oli

Jul 20 '05 #1
4 3128
news.ntlworld.c om wrote:
Hi everyone. I'm trying to emulate a simple table layout using CSS only.
This hyperlink (http://homepage.ntlworld.com/r.morris7/tabledemo.htm) shows
the intended result, which I've knocked up using a table.
It always great when people are going to a more structured document.
Please note a couple of things. The second line of text in the right-hand
columns don't wrap beneath the italic heading. The first column contains a
heading (of sorts, not an actual <hx> element) that is aligned to the right.

Any help would be much appreciated!


Could you explain what the content is going to be? There are multiple
solutions for this problem without tables, but to select the right one,
we (I) need to know what kind of data is going to be in there.
--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #2
Oli
> Could you explain what the content is going to be? There are multiple
solutions for this problem without tables, but to select the right one,
we (I) need to know what kind of data is going to be in there.


Hi Anne, it's actually going to be used for part of an HTML copy of my
Curriculum Vitae (resume). I'd like to have a heading (e.g. Languages) and
then a body of text following (e.g. Java, HTML, SQL etc.). The body of text
is only 2-4 lines of text but it's important that it doesn't wrap beneath
the heading.

I've had some mixed success, for example:

<p>Languages<sp an style="left: 150px; position: absolute">Java, JSP,
Servlets and JavaBeans; HTML, CSS, DOM and JavaScript; XML, DTD, XSLT and
X-Schema; SQL, PL-SQL and Oracle XSQL; UML.</span></p>

This almost works but I can't align the first word ('Languages') to the
right (refer to the table mockup for an example).

I also experimented with DIV layers:

<div style="position : absolute; text-align: right; width:
150px"><p>Langu ages</p></div>
<div style="position : absolute; left: 170px"><p>Java, JSP, Servlets and
JavaBeans; HTML, CSS, DOM and JavaScript; XML, DTD, XSLT and X-Schema; SQL,
PL-SQL and Oracle XSQL; UML.</p></div>

However, when I added more DIV layers (i.e. for another heading and body of
text) it overlapped the first heading and body of text. I suppose I could
offset the subsequent layers but I'd like a more fluid design which would
stand up to fonts being resized etc. and would be suitable for print and
screen.
Jul 20 '05 #3
Oli wrote:
Hi Anne, it's actually going to be used for part of an HTML copy of my
Curriculum Vitae (resume). I'd like to have a heading (e.g. Languages) and
then a body of text following (e.g. Java, HTML, SQL etc.). The body of text
is only 2-4 lines of text but it's important that it doesn't wrap beneath
the heading.


That makes it more clear. Thanks.

Without DOCTYPES etc, just a simple example:

<style type="text/css">
html{
font:85%/1.3 Arial,sans-serif;
}
h1{
font-size:1.5em
}
h2{
float:left;
width:15em;
font-size:1em;
}
div.section{
width:20em;
}
p{
margin:0;
padding:.1em 1em;
}
</style>
<h1>Document title</h1>
<h2>Section header</h2>
<div class="section" >
<p>Bla bla bla</p>
<p>Bla bla bla</p>
</div>
<h2>Section header</h2>
<div class="section" >
<p>Bla bla bla</p>
<p>Bla bla bla</p>
</div>
--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #4
Oli
Thanks for the reply, Anne. It's pointed me in some new directions to
experiment with.
Jul 20 '05 #5

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

Similar topics

9
9979
by: alex | last post by:
Hi, It seems like HTML 4.01 Transitional spec. doesn't allow table height to be expressed in percents. When i have this doctype tag: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> the percents don't work.
61
24509
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
7
5942
by: mr_burns | last post by:
hi, is the table percent value for height used for displaying in browsers. i have a table i want to run to the bottom of the screen so it seemed best to set the height value to 100%. when i display the table, it only sizes to the elements nested inside the table (as if no value for height has been given) and not to the bottom of the screen. i have also tried appling the height attribute as a css class but no joy.
12
39123
by: Rick DeBay | last post by:
I'm trying to create a layout table, where the spacing between rows varies. I've tried using setting margin-top and border-top for the rows I wan't spaced down from the one above, and I've also tried setting it on all of the cells of that row. This hasn't worked, so I was wondering if anyone knew how it could be done. Thanks, Rick DeBay
47
9160
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
4
5098
by: Rob Freundlich | last post by:
I have some servlet-generated tabular data that I need to present, so I'm using an HTML Table. In some cases, it can be quite large. I'm flushing the servlet output every N lines to push the data to the browser as it generates, and I've used "table-layout: fixed" for the table's CSS class. It works pretty well in Netscape (7.1 and higher) - the table is drawn pretty much as the rows are received by the browser. However, Internet...
4
81859
by: eomer | last post by:
I would like my table header to have a border on the bottom. What I have written works in Mozilla (1.7.12) but not IE (6). I have included the snippet of html and the snippets of CSS. Any suggestions would be appreciated. Thank you. http://www1.esc.edu/personalstu/fhartnet/books.html <tr class="lightblue">
117
18581
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of elements in the HTML to get everything just right. When you consider the class attribute on the DIV elements, there's not much size savings anymore for using DIV. There are other disadvantages to not using TABLE/TR/TD, such as the lack of ability...
9
2612
by: Daniel Kabs | last post by:
Hello there again! On my quest to remove layout tables in favor of CSS controlled elements, I am faced with quite a problem. A table cell that has no explicit width attribute set usually adapts its width to accommodate the content nicely. This is not the case when the content contains floats. I guess floats do not contribute to the table cell width as floated elements are taken out
2
2400
by: Geary | last post by:
I am porting my first traditional app to a web-based app using VS2005 and ASP.NET 2.0. I have a page that will replace a data entry form. To have complete control of layout, I want to use a table as a layout device. Typically I would go with a std html table. With VS2005 I have a choice of a html table control or the web table control. I understand the jus of differences between the two, but I am still unsure whether using the html...
0
9680
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
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10173
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
10006
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...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
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();...
1
4116
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
2925
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.