473,808 Members | 2,855 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 19304
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
10787
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
2406
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
5270
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
5847
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
13389
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
9600
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
10628
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
10373
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
10113
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
6880
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
5547
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
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
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
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.