473,804 Members | 3,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using <fieldset><lege nd> in a <div>

goatboy
7 New Member
So I am hosting a site from my home server, and I would like the main page to be an area for updates about the site. I am providing these updates in a blog-style format, using this code:

Expand|Select|Wrap|Line Numbers
  1. <form><fieldset>
  2. <legend>December 15, 2009</legend>
  3.  
  4. <p>This is an update.  Lorem ipsum, etc. etc. and so on.</p>
  5.  
  6. --goatboy
  7.  
  8. </fieldset></form>
  9.  
Now, while this layout looks exactly like what I want, it does not make sense to format it within a set of <form> tags. Is there a way to achieve the same style - a line around the content with the legend text interrupting the line - without using the <form> tag? Ideally, I'd like to just use <div> and <legend>, but something tells me that is not possible.

I'm entirely open to CSS, but I'd prefer staying away from images, javascript, and PHP. It's not that I don't like them or understand them, I just think it's easier to stick with what I have.

ADD: I have searched this forum and Google, but I'm not entirely sure what it's called, so my searches haven't turned up anything relevant.

Thanks in advance,
goatboy
Dec 16 '09 #1
6 19301
Dormilich
8,658 Recognized Expert Moderator Expert
Ideally, I'd like to just use <div> and <legend>, but something tells me that is not possible.
that one is called DTD. <legend> must only be used as child element of <fieldset>, which itself is only allowed inside <form>.

I’d propose a div with a border and a label bearing the text. use position: relative and a negative top value to shift the text onto the border.
Dec 16 '09 #2
drhowarddrfine
7,435 Recognized Expert Expert
Here's one example of what you can do with a div. Replacing the div with a p has the same effect:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title></title>
  5. <style type="text/css">
  6. div{border:1px solid;padding:10px}
  7. span{display:inline:block;position:relative;top:-20px;background-color:#fff;}
  8. </style>
  9. <body>
  10.  
  11.         <div><span>Some stuff.</span>More stuff</div>
  12.  
  13. </body>
  14. </html>
  15.  
  16.  
Dec 16 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. display:inline:block;
do you mean
Expand|Select|Wrap|Line Numbers
  1. display:inline-block;
?
Dec 16 '09 #4
goatboy
7 New Member
I'm sure that's what he meant, but changing it made no difference (at least in Firefox). Either way, that's exactly what I was looking for! Thank you!
Dec 16 '09 #5
Dormilich
8,658 Recognized Expert Moderator Expert
I think it doesn’t matter, if the display is inline or inline-block.
Dec 16 '09 #6
drhowarddrfine
7,435 Recognized Expert Expert
Yeah, the inline-block thing wasn't necessary.
Dec 16 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

14
10786
by: Ian Rastall | last post by:
I'm curious as to the group's feelings about using the <fieldset> and <legend> tags around elements other than <form> elements ... I wrote a small test file: <http://www.learnsomethingnew.us/fieldset.html> to illustrate this, and it validated at both the W3C and WDG sites. (It's a <fieldset> around a <table> and <p>). I'm able to view it on Opera 7.23, Mozilla 1.6, and IE 6. (Moz 1.6 renders it in Standards Compliance Mode as well.)
9
2054
by: Warren Post | last post by:
At <http://snow.prohosting.com/srcopan/src/search.html> I have a simple form, using the following code provided by my site search provider: <form method="get" action="http://search.atomz.com/search/"> <input size="20" name="sp-q"><br> <input type="submit" value="Search"> <input type="hidden" name="sp-a" value="sp06251400"> <input type="hidden" name="sp-p" value="any"> <input type="hidden" name="sp-f" value="ISO-8859-1"> </form>
4
1925
by: _Raven | last post by:
Okay, I am playing with submitting forms with Ajax. I am trying to adapt this script to my forms: http://www.captain.at/howto-ajax-form-post-get.php I have included my code at the bottom of this post. Basically, this will work correctly if I remove all non-form related tags from the form =eg span, div, but I want to format the form all pretty like so??? Right now, it only collects 2 parts of the form fields =sites &
0
2405
by: bobmct | last post by:
Gentlemen; I'm in the process of migrating several pages from HTML under frames to noframes using css using the three or four box design. For most of my efforts its going well. However, one area that's giving me a lot of grief is where I've encountered the user of <fieldset>. Whereas in the HTML use the box drawn by this tag simply encapsulates the elements contained, on the css controlled page the box drawn uses the maximum width...
5
5268
nathj
by: nathj | last post by:
Hi All, I'm working on a new site that has a two column layout underneath a title bar. If you check out: http://www.christianleadership.org.uk/scratch/mainpage.php using IE or Opera you will see what I am after as these browsers work fine. However, in FF the results are slightly different - take a look and you'll see that the <p>, within <div class="mainContent"> has shot way over to the right. I've been working on this for 2days now...
17
5843
by: malathib | last post by:
Hi, I have used a rich text editor in my application. I got it from one of the site.all are JS files. My problem is, i want to call a javascript function from the iframe. Can anybody help me in this regard
5
13388
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg instead of http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg As u see, there's the website URL before the image URL.
0
9706
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
9579
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
10575
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...
0
10330
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...
0
9144
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
5520
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...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
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
2990
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.