CSS - Creating Fancy Div/css Borders
I've always liked the various illustrated borders on some sites where the box or container of the text/images looks like an image itself, but it turns out to be something drawn with either CSS or some other web syntax.
I tried to find ways to make DIV elements have a rounded-corner box or use some images as a border that will scale or change as the object increases or decreases in size. What I found were the "border-radius" and "border-image" elements. However, from what I've read online and at this DevShed forum thread, these are proposed elements for CSS3 which are not available at this time. However, the effects that are similar or exactly what these proposed future elements are supposed to do are being used now. So the question is: HOW are web designers getting custom images or rounded corners on solid borders in DIV objects WITHOUT these elements? Is it another, non-CSS markup/programming language that is making this happen (i.e.- XML, Java, JavaScript, DHTML)? Similar TutorialsOne thing I've never been able to replicate using CSS that you can do w/ tables is a simple content area with tab, where the border goes just around those areas and there's a set width for the tab but no set width to the area beneath it. I'll try to graphically depict what I mean he _____________ |************|____________________ |*********************************| |*********************************| |*********************************| |*********************************| |*********************************| ------------------------------------------------- Seems simple enough, right? Just imagine that's a solid border and the asterisks are the content area, and I want to create this using only CSS and divs. The tab, say, is fixed at 100px, but the area below is at some percent, say 90% of the page. The problem ends up being the portion to the right of the tab. I need to create a div there so that the top right border is drawn, which is really the bottom border of that space. I can't simply give the area below a top border because then it would place a border under the tab, and I want the tab to be seamless with the area beneath. CSS can't figure out what the remaining width of the div to the right of the tab (at least without using the under developed display:table-cell), so I can't specify the width of that div, which means I can't know how far to extend it to reach the right side of the area below. So, generally, as far as I can tell, the above depiction can't be done without tables. Can anyone find a workaround? Please let me know if I'm not explaining this well enough. Thanks! I'm trying to make a basic 'business card' website for a family friend and I want to add a custom dotted border (alternating colours) around the inside of my container, but I'm not sure of the best way to achieve what this without lots of extra markup. Image of Current look Image of Desired look Here's the actual site. http://www.thenewsite.com/thelolmaster/ Hi guys, I am using the following css to style a content box: Code: /*---------------- Start of Testimonies Content Box ---------*/ #testimonies { WIDTH: 175px; MARGIN: -85px 0px 0px; POSITION: right; height: 60px; float:right; BORDER-RIGHT: #d9ddb9 1px solid; BORDER-LEFT: #d9ddb9 1px solid; BORDER-BOTTOM: #d9ddb9 1px solid; BORDER-TOP: #d9ddb9 1px solid; PADDING-TOP: 10px; PADDING-RIGHT: 10px; PADDING-BOTTOM: 20px; PADDING-LEFT: 10px; FLOAT: right; BACKGROUND-IMAGE: url(images/bg-down-right.gif); BACKGROUND-POSITION: 50% bottom; BACKGROUND-REPEAT: repeat-x; BACKGROUND-COLOR: #fafceb; } .testimonies-h2 { PADDING-RIGHT: 3px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; BACKGROUND-COLOR: #fafceb } #testimonies H2 { PADDING-RIGHT: 0px; BACKGROUND-POSITION: 2px 3px; PADDING-LEFT: 0px; FONT-WEIGHT: bold; FONT-SIZE: 100%; BACKGROUND-IMAGE: url(images/bg-h2.gif); PADDING-BOTTOM: 2px; TEXT-TRANSFORM: uppercase; COLOR: #8fa300; PADDING-TOP: 2px; BACKGROUND-REPEAT: repeat-x } /*---------------- End of Testimonies Content Box ---------*/ I want to add an inline frame inside the 'testimonies' div in my html but it keeps using the border styling of the css above. I tried using this to cancel it out (placing my inline frame in a span, but it did nothing) Code: #testimonials { border-left:none; border-right: none; border-bottom:none; border-top:none; } HTML CODE: Code: <div id="testimonies"> <h2><span class="testimonies-h2">Testimonials</span></h2> <span class="testimonials"> <!-- ========== V-NewsTicker v2.2 (Freeware) ============= --> <script type="text/javascript" src="v_newsticker_1.js"></script> <!-- ======================= --> </span> </div> Hello, I can't for the life of me figure out how to get these thin white borders like on this website: http://www.viceland.com/index_us.php Is this done with a style sheet? I can't find any reference to a border. How is this done? Can any one suggest a better CSS script for having a border in IE So far I have the following: PHP Code: border: 1px solid #0099CC; The problem is that when ran in IE, the top border does not show. However it works fine in firefox. Also I get warnings on my script when I run my CSS validation tool. Can any one help. Thge URL is http://pfwd.org.uk/sfd/update_test3.php Hi All, I am trying to set a style in my CSS that will show a border-bottom for an entire row. So far I can only get it to work on a per cell (<td>) basis. I am using Dreamweaver MX 2004 and when I select an entire row and assign it a style, it just add's it to the <tr> tags at the top of those rows. Code: <!-- This is a Row that is at the top of the table --> <table width="100%" border="0" class="fullwidth"> <tr> <td class="head">This is a header </td> </tr> </table> <!-- This is where I want the border-bottom attribute to show up --> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="list"> <tr class="list"> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr class="list"> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr class="list"> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr class="list"> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr class="list"> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> Here is the CSS: Code: table.fullwidth {width: 100%; background-color: #FFFFFF; border: 0px; border-collapse: collapse; border-spacing: 0px;} tr.list {background-color: #EFEFEF; font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: normal; color: #000000; border-bottom: 1px dotted #000000;} Is it possible to have more than one border in CSS? I want to have a grey and green border around an area of text, something like this. So is it possible to have two or more borders in CSS and if so, how? Hi, Im not sure what the problem is with my code, but it gives me full borders when I ask for only top and bottom. Here is my CSS. css Code: Original - css Code .logo{ width: 100%; border: 1px solid #FFFFFF; font-size: 32px; } .menu{ width: 150px; height: 320px; border: 1px solid #FFFFFF; text-align: left; } a.menu{ border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF; color: #FFFFFF; width: 100%; } .logo{ Here is my html of that part. html Code: Original - html Code <span style="float: left"> <div class="menu"> <a href="" class="menu">asdf</a><br /> <a href="" class="menu">asdf</a><br /> <span style="float: left"> <div class="menu"> <a href="" class="menu">asdf</a><br /> <a href="" class="menu">asdf</a><br /> Here is what it outputs. http://blacknine.net/test.html I have a small table that is not displaying borders in IE. On this page The section with Financial Aid and Parents should have a grey 3px border on the right hand side going from the header image to the person at the bottom. In FF it displays as intended. HTML Code: <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td id="finaid" class="finaid greybrdr"></td> <td id="parents" class="greybrdr"></td> <td id="students" class="students"></td> </tr> <tr> <td class="bod finaid greybrdr"></td> <td class="bod greybrdr"></td> <td class="bod students"></td> </tr> <tr> <td id="finback" class="greybrdr"></td> <td id="parback" class="greybrdr"></td> <td id="studback"></td> CSS Code: .greybrdr { border-right: 3px solid #e4e4e4; } .finaid { border-left: 2px solid white; } .students { border-right: 5px solid white; } .bod { width: 183px; height: 200px; background-color: #FFFFFF; } Hello, I have a list that looks like this Code: <ul> <li><a href="#"> List item 1</a></li> <li><a href="#"> List item 2</a></li> <li><a href="#"> List item 3</a></li> </ul> ... and my CSS for the list looks like this Code: ul { margin-left: 0px; list-style: none; border: none; border-top: 1px solid #000000; } li { border-bottom: 1px solid #000000; } li a { text-decoration: none; border-bottom: 1px solid #000000; border-left: 14px solid #82817C; color: #FFFFFF; background-color: #585752; } li a:hover { text-decoration: none; border-left: 14px solid #9D9E8E; border-bottom: 1px solid #000000; color: #FFFFFF; background-color: #585752; } My problem is that I can't get the borders go the way I want them to. As you can see, the list items have two borders, a left border and a bottom border. The unorganized list-tag has one border, a top border. In both cases, the top and bottom borders are 1px in height, and the left border is 14 pixels in width. The ul's top-border is full width, meaning it starts at the left side of the page, while again the li's bottom-border starts AFTER the left-border... ok, that was confusingly explained. What I'm trying to achieve is that the li's left-border is over lapped by it's bottom-border - so that the bottom border looks just like the ul's top-border. Ok, if you put the code to your editing program and view it "in action" you should be able to see what I mean. So to summarize it all, how can I force the bottom-border to over lap the left-border? Thank you in advance, - Kimppa q) In CSS or html, how can make my buttons and borders around a screen section ( created with css) have roundish borders and regular not corners q) How can i get the colors of such buttons to be a bit more exciting eg go from ligh to dark blue instead 1 uniform color? how can i use: css Code: Original - css Code .t {background: url(../images/dot.gif) 0 0 repeat-x; width: 20em; width:80%; left:50%; margin:20px; } .b {background: url(../images/dot.gif) 0 100% repeat-x} .l {background: url(../images/dot.gif) 0 0 repeat-y} .r {background: url(../images/dot.gif) 100% 0 repeat-y} .bl {background: url(../images/bl.gif) 0 100% no-repeat} .br {background: url(../images/br.gif) 100% 100% no-repeat} .tl {background: url(../images/tl.gif) 0 0 no-repeat} .tr {background: url(../images/tr.gif) 100% 0 no-repeat; padding:5px; } .t-exif {background: url(../images/dot.gif) 0 0 repeat-x; width: 20em; width:200px; right:0px;} .b-exif {background: url(../images/dot.gif) 0 100% repeat-x} .l-exif {background: url(../images/dot.gif) 0 0 repeat-y} .r-exif {background: url(../images/dot.gif) 100% 0 repeat-y} .bl-exif {background: url(../images/bl.gif) 0 100% no-repeat} .br-exif {background: url(../images/br.gif) 100% 100% no-repeat} .tl-exif {background: url(../images/tl.gif) 0 0 no-repeat} .tr-exif {background: url(../images/tr.gif) 100% 0 no-repeat; padding:10px; } .t {background: url(../images/dot.gif) 0 0 repeat-x; width: 20em; width:80%; left:50%; margin:20px; } to make my exif info box appear on the right of the image? i have tried using right:0px but it doesn't work, any ideas? current display page I'm sure there is a simple solution, but I'm drawing a blank. I'm trying to line up absolute divs but running into an issue where IE includes the border in the width and Netscape appears to tack the borders on - so if I have a div with a width of 100px and a border of 5px, IE diplays 100px, inclusive of the border. Netscape appears to dispay a div with a total width of 110px. <div align="center" class="box" style="top:49px; left:111px; width:100px; height:100px"><br>Test<br></div> .box {position:absolute; border: 5px double black; font: 200 9px arial} Havn't been able to find the property that may control this. ???? Hi, Someone I know is trying to find a way of putting a border round an image (say 1px white) followed by another border around that (say 1px blue). Anyone done this or have a good idea of a way to do it? thanks I have a site that uses many tables to display lists of data. I would like to use CSS to clean up these tables. In particular I want to put round corners around each table as a border. The tables vary in width and height so how can I do this? How do i apply visible and formated border to a certain cells without afecting the entire column or row? Im using the border properties like: border-buttom-style border-top-style border-left-style border-right-style border-width border-color etc, etc, but when apply the style the colum or the row is affected entirely, this makes my top sliced image (header) with the separators visible. Im new to css and need some help in doing this. Thx I have this code: Code: <html> <head> <style type="text/css"> body { font-family: arial, helvetica, serif; font-size: 100%; background: white; padding: 2em; margin: 0; } #content { width: 34em; background-color: #ffffff; padding: 1em 0; border: 6px double #6DA9CA; margin: auto; voice-family: "\"}\""; voice-family:inherit; width: 32em; } html>body #content { width: 32em; } a { text-decoration: none; } a:link { color: #080; } a:visited { color: #790; } a:active { color: red; } a:hover { text-decoration: underline; } ul { padding: 0; margin: 0; list-style: none; } li { float: left; position: relative; width: 10em; text-align: left; cursor: default; background-color: white; } li ul { display: none; position: absolute; top: 100%; left: 0; font-weight: normal; padding: 0.5em 0 1em 0; border: solid 1px #6DA9CA; } #submenu li ul { border: solid 1px #6DA9CA; } li>ul { top: auto; left: auto; } #nav a { color: black; } #nav a { text-decoration: none; } #nav li li a { display: block; font-weight: normal; color: #060; padding: 0.2em 10px; } #nav li li a:hover { padding: 0.2em 5px; border: 5px solid #6DA9CA; border-width: 0 5px; } li:hover ul, li.over ul{ display: block; } </style> <script type="text/javascript"> startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; </script> </head> <body> <ul id="nav"> <li><a href="">Home</a></li> <li><a href="">Guiding Principles</a></li> <li>Background & Qualifications</a> <ul> <li><a href="">Biography</a></li> <li><a href="">Dispute Resolution</a></li> </ul> </li> <li>Developments <ul> <li><a href="">International</a></li> <li><a href="">Specialty & Agrichemical News & Regulations</a></li> <li><a href="">Archive</a></li> </ul> </li> <li><a href="">Other Resources</a></li> </ul> </body> </html> And I like it - but I have one problem - I want there to be lines between each of the <li>s in the submenus - meaning between Biography and Dispute Resolution I want a line - I know there is no border-middle value - so how do I do this? I have a bit of CSS that wraps a border around an image, it works in IE but not in FF. What am I doing wrong? Code: .book_box { width: 95%; padding: 10px 5px 5px 5px; border: 2px solid white; background-color: #eef7ff; text-align : left; overflow: auto; } .book_box_img { float: left; margin: 5px; border: 1px; border-color: #003366; } I'd like to have a class in my style sheet that gives a table a 1 px border, something like this: Quote: <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="100%">test</td> </tr> </table> But I'm unsure how to do it. i want to tell an iframe to fill 100% width, but have a border of 1px this will cause horizontal scrolling since the width property does not include the border in its calculation. how can i do this? |