Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HTML/CSS Sliced Image Headaches!

Featured Replies

Hey,

 

I've sliced up this image that I'd like to put on a website, with tables it would be really easy to export from Adobe Illustrator as HTML/Images but I'm pretty sure thats frowned upon in the website design industry. So how do I do it? I was thinking about using absolute positioning, but that seems a bit confusing, is there an easy way?

 

1jPI7M.Screen%20shot%202010-07-06%20at%2023.14.13.png

 

HTML:

    <div id="bio">

     <img src="img/bio/bio1.png" name="bio1" width="124" height="154" id="bio1" />

     <img src="img/bio/bio2.png" name="bio2" width="401" height="83" id="bio2" />

     <img src="img/bio/bio3.png" name="bio3" width="401" height="71" id="bio3" />

     <img src="img/bio/bio4.png" name="bio4" width="525" height="176" id="bio4" />

   </div>

 

CSS:

#bio {
width:523px;
height:325px;
float:left;
}

The only part of that design which needs to be an image is the picture of you. The rest should be built up with CSS elements positioned as required.

 

Also just a tip, whilst It's good you can do this at your age (I know I certainly couldn't, doubt I even knew what HTML was at that age) I wouldn't really advertise the fact on your website, might put people off.

  • Author

How can I wrap the text right around an image like that without using images?

One of easiest ways:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>CBG</title>

<style>
body {font-family: arial, tahoma, verdana; color: #000; font-size:  15px;}
#main {width: 500px; background: #f0f0f0; margin: 0 auto; padding:  10px;}
#cbg {margin: 0 10px 10px 0; padding: 5px; border: solid 1px #ddd;  background: #fff; position: relative; zoom: 1;}
h1 {font-size: 21px; color: #777; text-transform: uppercase;  line-height: 30px; padding: 0; margin: 0 0 15px 0;}
h1 span {background: #fc0;}
p {padding: 0; margin: 15px;}
.clrfx {clear: both;}
</style>

</head>
<body>
<div id="main">
<img src="http://www.webdesignerforum.co.uk/uploads/av-10093.jpg" width="94" height="125" alt="" border="0" align="left" id="cbg" />
<h1>Hey! I'm <span>Charlie Gordon</span> & I'm a freelance <span>web designer!</span></h1>
<p>I've sliced up this image that I'd like to put on a website, with tables it would be really easy to export.</p>
<div class="clrfx"></div>
<p>I've sliced up this image that I'd like to put on a website, with tables it would be really easy to export.</p>
<p>So how do I do it? I was thinking about using absolute positioning, but that seems a bit confusing, is there an easy way?</p>
</div>
</body>
</html>

One of the easiest ways:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>CBG</title>

<style>
body {font-family: arial, tahoma, verdana; color: #000; font-size:  15px;}
#main {width: 500px; background: #f0f0f0; margin: 0 auto; padding:  10px;}
#cbg {margin: 0 10px 10px 0; padding: 5px; border: solid 1px #ddd;  background: #fff; position: relative; zoom: 1;}
h1 {font-size: 21px; color: #777; text-transform: uppercase;  line-height: 30px; padding: 0; margin: 0 0 15px 0;}
h1 span {background: #fc0;}
p {padding: 0; margin: 15px;}
.clrfx {clear: both;}
</style>

</head>
<body>
<div id="main">
<img src="http://www.webdesignerforum.co.uk/uploads/av-10093.jpg" width="94" height="125" alt="" border="0" align="left" id="cbg" />
<h1>Hey! I'm <span>Charlie Gordon</span> & I'm a freelance <span>web designer!</span></h1>
<p>I've sliced up this image that I'd like to put on a website, with tables it would be really easy to export.</p>
<div class="clrfx"></div>
<p>I've sliced up this image that I'd like to put on a website, with tables it would be really easy to export.</p>
<p>So how do I do it? I was thinking about using absolute positioning, but that seems a bit confusing, is there an easy way?</p>
</div>
</body>
</html>

  • Author

Thats almost perfect, but I'd like my image at an angle (See first post) is there anyway I can do this and have it wrap around the angled image? Many thanks.

What prevent you from to cut out and insert here "angled" image?

  • Author

Well the text still wraps around the image like it was a square, is there a way to actually wrap it around tightly?

Only individual positioning for every text line that must wrap around the picture, I guess.

  • Author

Ok fair enough, probably too much bother then.

 

1k0nj.Screen%20shot%202010-07-07%20at%2011.37.06.png

 

Well I've done this so far, which looks good, but how can I change the span so there is more padding on the left and right sides but more on the top and bottom? Adding padding doesn't seem to have any effect..

  • Author

Just to let you guys know its all sorted now, I'll keep you guys updated on my site as I'm making it, heres my progress so far (:

 

1kdA4e.Screen%20shot%202010-07-07%20at%2021.51.38.png

I'm not sure about the background, should I leave it like that with the photoshop style blank canvas pattern, or should I make it light grey?

I'm not sure about the background, should I leave it like that with the photoshop style blank canvas pattern, or should I make it light grey?

 

That canvas background defines that its "transparent", so your gonna need to add a background colour to it.

 

Well I've done this so far, which looks good, but how can I change the span so there is more padding on the left and right sides but more on the top and bottom? Adding padding doesn't seem to have any effect..

 

You can specify different amounts of margin/padding for the top, bottom, left and right. I suggest you check out some CSS tutorials. Its really easy to pick up the basics;

 

http://htmldog.com/guides/cssbeginner/

 

 

Kyle

  • Author

Hey, the photoshop background is actually the background I created it is not in photoshop, I created the background because I thought it looked creative but I'm not sure about it.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.