[solved] Splitting a rectangle into two open-ended pieces

Post about projects that use Inkscape for web design.
ptc
Posts: 12
Joined: Fri Jul 18, 2008 6:32 am

[solved] Splitting a rectangle into two open-ended pieces

Postby ptc » Fri Jul 18, 2008 6:37 am

Hi,

I'm new to inkscape and to illustration software in general. So far so good, but I'm up against an obstacle. I need to make the header on my wiki website expandable with different resolutions and screen sizes. To do that, I need to split the long, narrow rectangle on which the header is based into two pieces that overlap. I need to make the clipped ends look as if the boxes simply end, like I cut them with scissors. It's literally just a long box made with the rectangle tool.

Any help?

Thanks!

SureWhyNot
Posts: 137
Joined: Mon Jun 16, 2008 11:37 pm
Location: United States

Re: Splitting a rectangle into two open-ended pieces

Postby SureWhyNot » Fri Jul 18, 2008 6:51 am

Do you mean something like one of these?

Image

ptc
Posts: 12
Joined: Fri Jul 18, 2008 6:32 am

Re: Splitting a rectangle into two open-ended pieces

Postby ptc » Fri Jul 18, 2008 6:57 am

Thanks for your response!

Yes, the top yellow pair most closely resembles what I'm after. I want them to overlap so that their connection is undetectable and they appear to be one box that grows longer and shorter with the width of the browser page.

llogg
Posts: 443
Joined: Tue Mar 11, 2008 7:30 am

Re: Splitting a rectangle into two open-ended pieces

Postby llogg » Fri Jul 18, 2008 7:22 am

Could you explain your question a little more? I don't understand what benefit you could possibly get out of making the rectangle into two ovelapping objects rather than simply changing the size of the rectangle.

ptc
Posts: 12
Joined: Fri Jul 18, 2008 6:32 am

Re: Splitting a rectangle into two open-ended pieces

Postby ptc » Fri Jul 18, 2008 7:48 am

Certainly, thanks for asking.

Look at the Inkscape forum header at the top of this page. It narrows and widens as you drag your browser wider or narrower. As a result, the search box stays in view as you shrink the browser window. This can be achieved by posting two images designed to overlap. One image disappears behind the other, giving the effect of a single shrinking or expanding image.

If that header were a single image of fixed width, it wouldn’t shrink and expand like that, and the search box would disappear off the side of the page as the browser is dragged smaller.

There may be a better way to achieve what I’m after, but the way I’m doing it requires two images, cut and overlapping so that the seam is invisible.

You can see the problem in action here: http://www.mythopoedia.com

SureWhyNot
Posts: 137
Joined: Mon Jun 16, 2008 11:37 pm
Location: United States

Re: Splitting a rectangle into two open-ended pieces

Postby SureWhyNot » Fri Jul 18, 2008 8:00 am

Wait a second, I made the below tutorial before reading the post above. I don't understand why you would do that. Don't have the images overlap, have a small piece repeat x number of times, based on the browser width, then cap them with the rounded part.


Image

ptc
Posts: 12
Joined: Fri Jul 18, 2008 6:32 am

Re: Splitting a rectangle into two open-ended pieces

Postby ptc » Fri Jul 18, 2008 8:23 am

Thanks so much! And thanks for the creative presentation. I think my problem may be complicated by the fact that I'm using rounded corners and a gradiated "shine". Any suggestions?

SureWhyNot
Posts: 137
Joined: Mon Jun 16, 2008 11:37 pm
Location: United States

Re: Splitting a rectangle into two open-ended pieces

Postby SureWhyNot » Fri Jul 18, 2008 8:58 am

Image

Code: Select all

<table style="padding:0;margin:0" cellspacing="0">
<tr>
<td style="padding:0;margin:0"><img src="barleft.png"/></td>
<td style="background: url(barmid.png) repeat-x;padding:0;margin:0"></td>
<td style="padding:0;margin:0"> <img src="barright.png"/>
</tr>
</table>


(proper CSS usage not shown ;) )

ptc
Posts: 12
Joined: Fri Jul 18, 2008 6:32 am

Re: Splitting a rectangle into two open-ended pieces

Postby ptc » Fri Jul 18, 2008 9:19 am

Again, thank you so much. I hope you won't mind another question.

I'm still trying to get the split right. Do I have to split all the elements separately? By that I mean, do I have to chop the end first off the graduated shine, then off the solid blue base? Is that a matter of splitting the elements individually, then lining them up?

Your example looks flawless. Is there a way to split everything together, to ensure a clean fit online?

Thanks again!

SureWhyNot
Posts: 137
Joined: Mon Jun 16, 2008 11:37 pm
Location: United States

Re: Splitting a rectangle into two open-ended pieces

Postby SureWhyNot » Fri Jul 18, 2008 10:46 am

You want three pieces. The start, the middle piece that gets repeated, and the end piece. All tree are in a separate td.

Honestly, it might be best to forget the solid blue line... :?

I'm really inexperienced with HTML and such, and this solution might be light years more convoluted then some other solution I can't think of but...

**(ok, I tried doing my idea and it just got way to silly, so forget it. Sorry.)** :(

ptc
Posts: 12
Joined: Fri Jul 18, 2008 6:32 am

Re: Splitting a rectangle into two open-ended pieces

Postby ptc » Fri Jul 18, 2008 1:30 pm

In your orange graduated shape, is that gradient an overlay, or is it a single element graduated from orange to yellow?

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Splitting a rectangle into two open-ended pieces

Postby microUgly » Fri Jul 18, 2008 2:44 pm

You might like to go to a HTML forum or look for some tutorials to get an idea of how to break up an image for HTML. "Slicing" is the term used to break down a rectangle into a seperate pieces for use in HTML. But Inkscape is a little clumsy at slicing if you don't know how. Your best bet is to export your rectangle as PNG then use something like GIMP to slice it.

But using SWN's images, this is the clean correct HTML:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css" >
#header {
  background:#FFF url(bar-middle.gif) repeat-x;
  padding:0;
}

#header .wrap {
  background:#FFF url(bar-left.gif) top left no-repeat;
  padding:0;
  margin:0;
}

#header .wrap .wrap2 {
  background:#FFF url(bar-right.gif) top right no-repeat;
  padding:0;
  margin:0;
}
</style>
</head>

<body>
<div id="header">
  <div class="wrap">
    <div class="wrap2">
      <h1>Hello World!</h1>
    </div>
  </div>
</div>
</body>
</html>


If this doesn't make sense to you, then this is why you should go look for some tutorials that will explain all these concepts in detail. I think "A List Apart" has some good ones that deal with this.

SureWhyNot
Posts: 137
Joined: Mon Jun 16, 2008 11:37 pm
Location: United States

Re: Splitting a rectangle into two open-ended pieces

Postby SureWhyNot » Sat Jul 19, 2008 1:22 am

Ummm...that didn't work ugly. (yes, I changed the file names)

All I got was "hello world" and half of the right cap...

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: Splitting a rectangle into two open-ended pieces

Postby microUgly » Sun Jul 20, 2008 12:20 pm

I made a mistake by setting background colour, but here is a full working copy for you to examine - http://www.mediafire.com/?ewetseeed5h


Return to “Inkscape & the Web”