• 0

Best way to create rounded corners on input box?


Question

Hi All,

I'm doing some coding and the design calls for some rounded input boxes and submit buttons with varying lengths. I am sort of in a bit of a 'pickle' at the moment as to deciding which is the best way to go about this. I was thinking of one of these two options:

1) Using NiceForms (which I personally reckon seems like overkill for simply rounded input and submit form fields)

2) Using the following code:

<div class="inputleft"></div>
<input type="text" size="20" name="text" />
<div class="inputright"></div>

Then styling the divs accordingly.

All feedback is appreciated.

Thanks,

Smctainsh

19 answers to this question

Recommended Posts

  • 0

Hmm... if they're (or you're?) that insistent on the rounded input boxes then try curvycorners, it's extremely light-weight and should work on any element, but it does need javascript enabled... the divs method wouldn't require any scripting but would have quite obfusticated markup. Personally, I'd go for the second as I really don't care if people viewing the source of my website aren't aesthetically pleased by the mounds of plaintext. :p

  • 0

You could actually get by with something like this:

<div class="inputLeft"><input type="text" blah blah ></div>

Then in the CSS - you'd have a background image of the DIV to the left, and then have the input box with a background image floating to the right. It would be very similar to the the "sliding door" effect used in tabs. Granted, its only 1 less div, but I think it makes for a bit better markup.

  • 0
Good idea, jukeboxhero52... didn't think of that one.

Oh for CSS3...

input.text {
	border:2px solid #333333;
	border-radius:10px;
}

Can't wait until that stuff becomes usable.

Looks amazing, I can't wait (I'm using NiftyCorners for my site right now), when will it become a standard?
  • 0
Good idea, jukeboxhero52... didn't think of that one.

Oh for CSS3...

input.text {
	border:2px solid #333333;
	border-radius:10px;
}

Can't wait until that stuff becomes usable.

It'll be great once that is implemented and available. :)

Thanks for the assistance everyone. I've decided to use a CSS method as opposed to a javascript method, and I think I'll implement something similar to what jukeboxhero52 suggested.

Thanks again for all of your help everyone. :)

Smctainsh

  • 0
Looks amazing, I can't wait (I'm using NiftyCorners for my site right now), when will it become a standard?

Well different portions of CSS3 are currently supported by gecko, safari and opera and both gecko and opera should have close to full support by the next full version number... but considering even IE7 doesn't have complete compliance to CSS1 yet and only supports a bit of CSS2, it'll probably IE10 before it becomes viable for practical sites... either that or a real big boom in firefox takeup. ;)

If you want to play with the rounded corners, -moz-border-radius works in firefox 2 / latest seamonkey.

  • 0

I'll go down in levels of compatibility (first = highest)

  1. GIF images
  2. PNG images
  3. border-radius

GIF images will work in probably anything

PNG images will work in IE6 and such (with mods), and Opera, Safari, IE7, etc. and such

border-radius will work in latest versions of Firefox, Safari (well, WebKit) and Konqueror (no idea about opera)

Now, border-radius is part of the CSS3 Backgrounds and Borders Module, and due to how CSS3 is being made, individual modules can reach implementation state before others (i think one module is already at that stage), but because this certain module is still draft stage, and can change, the implementations in engines have a testing prefix (e.g. -moz-border-radius,-webkit-border-radius), and some implementations still have bugs or render oddly (e.g. Gecko's)

Now, wasn't that a nice bit of useless facts :p

Edit: not -gecko-border-radius, it's -moz-border-radius >.<

  • 0

http://doyouwanttodie.com/files/web_stuff/...d%20corners.png

As you can see, rounded corners look great in the latest WebKit build (and that not all of them render, haven't checked why)

Edited by The_Decryptor
  • 0
http://doyouwanttodie.com/files/Pictures/r...d%20corners.png

As you can see, rounded corners look great in the latest WebKit build (and that not all of them render, haven't checked why)

Wow, look good... yay for mac antialiasing :p none of them should be rendering at all though, I didn't put any webkit or general properties in, only -moz O_o

I'll put in -webkit ones now.

  • 0

I put in the -webkit- bits

Oh, and from reading the css spec, border-radius only takes one value (which makes sense with WebKit's rendering, it's only taking the first value, which is either 0px or 10px), for individual corners there are other values.

IMO, that's wrong, border-radius should be able to combine all the values, but there is a reason the spec and implementation's are still draft stages ;)

  • 0
I put in the -webkit- bits

Oh, and from reading the css spec, border-radius only takes one value (which makes sense with WebKit's rendering, it's only taking the first value, which is either 0px or 10px), for individual corners there are other values.

IMO, that's wrong, border-radius should be able to combine all the values, but there is a reason the spec and implementation's are still draft stages ;)

Name: border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-top-left-radius, border-radius

Value: <length> <length>?

Seems to me it takes 2... I dunno. That'd be the reason most of it isn't working in safari though - safari's spewing at the multiple specifications and not rendering them at all.

  • 0

the Name: bit is the different properties (the section is entitled "The 'border-radius' properties"), i have no idea why the two "<length> <length>?" values though.

And i got it working in Safari, it only takes 1 value for border-radius, and needs to have individual corners specified as the CSS rules (which are different to the gecko rules, gecko has the wrong rules though)

http://doyouwanttodie.com/files/web_stuff/CSS3/4.html < renders the same in Safari and Firefox.

http://doyouwanttodie.com/files/web_stuff/...corners%202.png < in latest WebKit

Edit: i just noticed a bug in the rendering, look at the navigation "tab", the antialiasing is "off"

Edited by The_Decryptor
  • 0

Yep, that's it, border-radius:10px 20px; gives a funny corner.

http://doyouwanttodie.com/files/web_stuff/...corners%203.png

Ok, messing around with some CSS3 rules, and i have to say, it rocks

testing RGBA colours in Safari (Firefox 2 screws this up): http://doyouwanttodie.com/files/web_stuff/...ari%20rocks.png

Without RGBA: http://doyouwanttodie.com/files/web_stuff/...ss3%20rocks.png

Test page: http://doyouwanttodie.com/files/web_stuff/...0test/css3.html

Test page 2 (with RGBA): http://doyouwanttodie.com/files/web_stuff/...ss3-safari.html

Edited by The_Decryptor
  • 0

I have Tahoma installed (comes with office for mac and some other things i think), and OS X's great font rendering does have something to do with it.

In the CSS3 page i did, that's using Lucida Grande (as you would see if you checked page source)

  • 0

Ahh, i get what you mean, yeah, that's the default serif font ( it's Times at 16px and italic, Safari doesn't give me much info on what it uses, it only shows me the default and fixed width font choices).

and while opacity is ok, it's simplistic, it controls the blending of the whole element (and sub elements), whereas RGBA colours can be applied to anything that takes a colour (font, border, etc.).

I'm still waiting on more support for SVG and SMIL animation though, a mix of those items with HTML would make for some great sites (e.g. shrink this element, rotate this one, scale and skew that one, etc.)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Who is paying for this 30x scale-up? Its sounds expensive.
    • Millions of users to benefit from Windows 11's new performance boost on Adobe Photoshop by Sayan Sen Despite the advent of AI-generated imagery, Adobe's Photoshop remains one of the most popular tools on this planet. Adobe does not have a publicly reported total user count but it's probably not wrong to assume there are millions. As of 2025, Adobe Creative Cloud has had approximately 41 million paid subscribers, many of whom likely use Photoshop. In addition, more than 166,000 companies worldwide are apparently also using the app. These figures are according to a very recent report by SQ Magazine. Out of them, it is fair to assume that many are probably running Windows. As such, there is good news for these users as Microsoft has announced Photoshop is getting a big 20% performance boost on x86-64 (AMD64) systems and a 13% bump-up on Arm devices. This is definitely great news for them as many have complained about the slow performance and general sluggishness of Photoshop on Windows 11 ever since the advent of the latter back in 2021. If you are wondering how Microsoft managed to do this, the answer lies in a combination of compiler-level optimizations and a technology called Sample Profile Guided Optimization (SPGO). According to Microsoft, Adobe worked closely with the company’s Visual C++ team and adopted the latest MSVC toolchain enhancements together with SPGO to squeeze more performance out of Photoshop’s CPU-bound workloads. Unlike traditional Profile Guided Optimization (PGO), which requires developers to create special instrumented builds and run lengthy training workloads, SPGO gathers performance data directly from optimized release binaries. This means Adobe could collect real-world usage information which gives a major advantage to this technique, as companies could leverage data collected from actual customer workloads rather than only relying on synthetic benchmark runs. In theory, this should allow optimizations to better reflect how users interact with software in the real world. Thanks to this, there are improvements to code layout, function inlining, hot-and-cold code separation, and other low-level tweaks that help processors execute instructions more efficiently. Essentially the compiler is better able to identify “hot” code paths, those which are most frequently executed, and optimize them accordingly.
    • "The 2TB Samsung 990 PRO NVMe SSD hits lowest price in over three months¨ I'd prefer to see the lowest price in over a year
    • Glad these prices are starting to come down, but that is still crazy. I bought the 2TB 9100 Pro (slightly more expensive version with PCIe 5.0) last year for $240.
    • The 2TB Samsung 990 PRO NVMe SSD hits lowest price in over three months by Sayan Sen Yesterday, we covered a really good deal wherein you can get a 4TB TeamGroup T-FORCE G50 NVMe PCIe Gen4 SSD for a low price of just $400 with a special discount coupon. That's just $100 per TB, making it a very good offer during these hard times. The deal is still live, so you can check it out in its dedicated article here if you do not want to miss out. Meanwhile, if you don't have that kind of budget but still wish to buy an SSD for a good price, the 2TB variant of the TeamGroup SSD at $280 its lowest price in over three months. Meanwhile, those seeking 2TB but faster performance can check out Samsung's 990 PRO, which has hit the lowest price also in the last quarter or so, as it's on sale for $370 (purchase links under the specs table down below). Thus, you want a faster drive, get the 990 Pro, or you want more capacity, grab the TeamGroup 4TB linked in the first para. The 990 PRO is a PCIe Gen4 NVMe SSD and still one of the fastest drives available today for under $500. Speaking of fast, sequential reads and writes are rated at 7450 MB/s and 6900 MB/s, respectively. The random throughputs for reads and writes are 1400K IOPS and 1550K IOPS, respectively. The 990 PRO is based on Samsung's 7th Gen V-NAND flash, and it too is TLC. It packs 2 gigs of LPDDR4 DRAM cache, which helps the random performance. The endurance rating for this is 1200 TBW (terabytes written), which should be sufficient for most users. The Samsung 990 PRO is compatible with the PlayStation 5, but if you are going to use the 990 PRO on a PC, check out the Samsung Magician app that lets you track your drive's health, update its firmware, customize various settings, and more. The tech specs are given below: Specification TeamGroup T-FORCE G50 2TB Samsung 990 PRO 2TB Interface PCIe 4.0 x4, NVMe 1.4 PCIe Gen 4.0 x4, NVMe 2.0 Form Factor M.2 2280 M.2 2280 Controller InnoGrit Controller Samsung In-house Controller NAND Flash 3D TLC 3D TLC DRAM Cache None (HMB supported) 2GB LPDDR4 Sequential Read (Max) 5,000 MB/s 7,450 MB/s Sequential Write (Max) 4,500 MB/s 6,900 MB/s Random Read (4K) Up to 600,000 IOPS Up to 1,400,000 IOPS Random Write (4K) Up to 700,000 IOPS Up to 1,550,000 IOPS TBW (Endurance) 1,300 TBW 1,200 TBW MTBF 3,000,000 hours 1,500,000 hours Operating Temperature 0°C to 70°C 0°C to 70°C Storage Temperature -40°C to 85°C -40°C to 85°C Shock Resistance 1,500G / 0.5ms 1,500G / 0.5ms Heatsink Patented Graphene Heat Spreader No Get them at the links below: Samsung 990 PRO SSD 2TB (MZ-V9P2T0B/AM): $369.99 (Sold and Shipped by Amazon US) TEAMGROUP T-Force G50 2TB SSD (TM8FFE002T0C129): $279.99 (Sold by TeamGroup, Shipped by Amazon US) Good to know This Amazon deal is U.S. specific, and not available in other regions unless specified. We only use first-party seller links (at the time of article publishing); ensure that you purchase from a first-party seller link only. Check out Today's Deals on Amazon | or our recent tech deals. Become a Prime member (for Students or SNAP) via Neowin Get Prime Access - Prime for half price (for qualifying Medicaid, EBT, SNAP) Subscribe to Prime Video, Audible Plus, Music Unlimited or Kindle Unlimited via Neowin As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • First Post
      Jocimo earned a badge
      First Post
    • Week One Done
      suprememobiles48 earned a badge
      Week One Done
    • One Month Later
      Windows Guy earned a badge
      One Month Later
    • One Month Later
      Prasann earned a badge
      One Month Later
    • Week One Done
      Prasann earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      522
    2. 2
      +Edouard
      174
    3. 3
      PsYcHoKiLLa
      90
    4. 4
      Steven P.
      81
    5. 5
      ATLien_0
      70
  • Tell a friend

    Love Neowin? Tell a friend!