/    Sign up×
Community /Pin to ProfileBookmark

Stetching [need help to fix it]

Hello folks
I tried to design this page for myself:

[B][URL=”http://www.8pic.ir/images/rtnr610nod5lv6uqntqb.jpg”]FIRST PICTURE[/URL][/B] [What I Want]

And I did, but the problem is my page is kinda stretching. How can I fix it? It looks like this:

[B][URL=”http://www.8pic.ir/images/3lcx1o6txm4xrglbgpro.jpg”]SECOND PICTURE[/URL][/B] [WHAT I’ve DESIGNED]

But I want it to be just like the first picture. I tried fixing it with testing different “width” and adding “div style”, but it didn’t help.
here’s my code, first HTML and second CSS:

[code]
<!DOCTYPE html>
<html lang=”ar” dir=”rtl”>
<head>

<meta charset=”utf-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>

<title></title>

<link rel=”stylesheet” href=”css/page.css” media=”screen”>

</head>
<body>

<div id=”container”>

<div id=”header”>

<div id=”header-content-top”>
TEST
</div><!– end #header-content-top –>

<div id=”header-content-bottom”>
<ul id=”social”>
<li><a href=”http://www.gmail.com”>
<span style=”position: absolute; right: 7px; top: 24px; width: 46px; height: 46px”></span></a></li>
<li><a href=”http://www.yahoo.com”>
<span id=”yah” style=”position: absolute; right: 3px; top: 25px; width: 46px; height: 46px”></span></a></li>
<li><a href=”http://www.google.com”>
<span id=”goo” style=”position: absolute; right: -3px; top: 25px; width: 46px; height: 46px”></span></a></li>
<li><a href=”http://www.rss.com”>
<span id=”rss” style=”position: absolute; right: -8px; top: 25px; width: 46px; height: 46px”></span></a></li>
</ul>
</div><!– end #header-content-bottom –>

</div><!– end #header –>

<div id=”content”>
<p>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
TEST
<br>
</br>
</p>
</div><!– end #content –>

<ul id=”navigation”>
<li><a href=””>TEST</a></li>
<li><a href=””>TEST</a></li>
<li><a href=””>TEST</a></li>
<li><a href=””>TEST</a></li>
</ul><!– end #navigation –>

</div><!– end #container –>

</body>
</html>
[/code]

[code]
html,body {
height:100%;
margin:0;
direction:rtl;
font: 16px Tahoma, sans-serif;
}
#container {
min-height:100%;
background-color:#fcdfb3;
background-image:url(../images/container-bg.png);
background-size:25% 1px;
background-position:100% 0;
background-repeat:repeat-y;
overflow:hidden;
}
#header {
height:213px;
padding:0 1.5%;
background-color:#fff;
background-image:url(../images/header-bg.png);
background-repeat:repeat-x;
font-size:200%;
color:#d68533;
}
#header-content-top {
line-height:89px;
margin-bottom:48px;
}
#header-content-bottom {
height:46px;
padding:15px 0;
}
#social {
padding:0;
margin:0;
list-style-type:none;
}
#social li {
float:left;
margin:0 2px;
}
#social a,#social span {
position:relative;
display:block;
width:46px;
height:46px;
font-size:40%;
}
#social span {
position:absolute;
top:0;
left:0;
background-image:url(../images/social-bg.png);
}
#social a:hover {
opacity:0.6;
}
#yah {
background-position:-46px 0;
}
#goo {
background-position:0 -46px;
}
#rss {
background-position:-46px -46px;
}
#content {
float:left;
width:47%;
padding:1.5%;
margin:20px 12.5%;
border-radius:15px;
box-shadow:inset 0 0 2px #301409;
background-color:#ecbd75;
font-size:100%;
color:#41251a;
}
#content h1 {
text-align:center;
}
#navigation {
float:right;
width:25%;
padding:0;
margin:0;
list-style-type:none;
}
#navigation li {
border-bottom:1px solid #d68533;
}
#navigation a {
display:block;
line-height:42px;
background-color:#41251a;
font-size:100%;
color:#d68533;
text-decoration:none;
text-align:center;
}
#navigation a:hover {
background-color:#d68533;
color:#41251a;
}
[/code]

Thanks

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@jedaisoulJun 08.2014 — You need to add a max-width for body in the CSS. E.g.

body {

max-width:800px:

}
Copy linkTweet thisAlerts:
@deathshadowJun 08.2014 — Biggest problem I'm seeing is WAY too much absolute positioning and non-semantic markup.... but that's to be expected from the "I can draw a pretty picture in Photoshop" design method, which to be frank puts the cart before the horse and is a completely back-assward way of making a site.

First thing I'd do is get some semantic markup on that... probably with a RECOMMENDATION doctype, not that HTML 5-tardery. Something like:

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html
xmlns="http://www.w3.org/1999/xhtml"
lang="en"
xml:lang="en"
<i>&gt;</i>&lt;head&gt;

&lt;meta
http-equiv="Content-Type"
content="text/html; charset=utf-8"
/&gt;

&lt;meta
http-equiv="Content-Language"
content="en"
/&gt;

&lt;meta
name="viewport"
content="width=device-width; height=device-height; initial-scale=1.0"
/&gt;

&lt;link
type="text/css"
rel="stylesheet"
href="screen.css"
media="screen,projection,tv"
/&gt;

&lt;title&gt;
Test Template
&lt;/title&gt;

&lt;/head&gt;&lt;body&gt;

&lt;div id="top"&gt;

<i> </i>&lt;h1&gt;
<i> </i> Site Title
<i> </i>&lt;/h1&gt;

<i> </i>&lt;ul id="social"&gt;
<i> </i> &lt;li&gt;&lt;a href="http://www.gmail.com"&gt;gmail&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://www.yahoo.com"&gt;yahoo&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://www.google.com"&gt;google+&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="http://www.rss.com"&gt;RSS&lt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
<i> </i>&lt;/ul&gt;

&lt;!-- #top --&gt;&lt;/div&gt;

&lt;div id="columnWrapper"&gt;

<i> </i>&lt;div id="extras"&gt;

<i> </i> &lt;ul id="navigation"&gt;
<i> </i> &lt;li&gt;&lt;a href="#"&gt;TEST&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="#"&gt;TEST&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="#"&gt;TEST&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;li&gt;&lt;a href="#"&gt;TEST&lt;/a&gt;&lt;/li&gt;
<i> </i> &lt;/ul&gt;

<i> </i> &lt;!-- extra wrapping DIV is so if you want something after the navigation --&gt;

<i> </i>&lt;!-- #extras --&gt;&lt;/div&gt;

<i> </i>&lt;/div&gt;&lt;!-- end #header --&gt;

<i> </i>&lt;div id="content"&gt;
<i> </i> &lt;h2&gt;Content&lt;/h2&gt;
<i> </i> &lt;p&gt;
<i> </i> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo commodo nisl, non accumsan quam hendrerit sed. Vivamus tempus, felis eget euismod congue, libero nisi vulputate lectus, in facilisis libero augue id nibh. Duis blandit lobortis augue vel laoreet. Pellentesque eget arcu convallis, semper elit nec, fermentum arcu. Phasellus sollicitudin sit amet sem ac accumsan. Nullam auctor elementum luctus. Curabitur porta imperdiet lacus vitae pharetra. In molestie nunc a augue cursus, vel congue felis dictum. Quisque tempus gravida mauris. Fusce lectus mi, egestas vitae viverra sit amet, feugiat quis dolor. Suspendisse mollis elementum tortor ac aliquam. Donec tristique enim non mauris dignissim elementum.
<i> </i> &lt;/p&gt;&lt;p&gt;
<i> </i> *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc tincidunt scelerisque tellus a ultrices. Quisque varius nibh ac gravida lacinia. Fusce vehicula mi vel purus adipiscing pharetra. Pellentesque adipiscing a lectus eu ultrices. Cras eget dictum est. Donec purus elit, euismod non consequat in, feugiat vehicula orci. Sed est nulla, sollicitudin eu orci nec, euismod gravida nulla. Nunc eget luctus quam. Vivamus condimentum pulvinar eleifend. Aenean in risus mauris. Curabitur vestibulum dapibus tincidunt. Nunc lobortis nulla sit amet turpis faucibus pellentesque. Integer hendrerit tristique bibendum. Etiam vitae faucibus massa.
<i> </i> &lt;/p&gt;&lt;p&gt;
<i> </i> Praesent nulla purus, posuere at condimentum non, tincidunt sed odio. Aliquam ornare orci a sapien blandit, a vulputate nibh luctus. Aenean ultrices vel ligula suscipit congue. Proin id sapien ullamcorper, imperdiet ante nec, sagittis nunc. Morbi sed ligula eu nibh consequat dignissim in eget orci. Nunc id bibendum nunc. Ut egestas diam nec dictum ornare. Nullam malesuada aliquam mauris, vel tempor mauris euismod in. Mauris molestie mi at velit vulputate aliquam tempor sit amet lectus. Phasellus dapibus tincidunt quam, a vulputate sapien aliquet ac. Nunc ligula ante, dapibus sed bibendum nec, bibendum ac arcu.
<i> </i> &lt;/p&gt;

<i> </i>&lt;!-- #content --&gt;&lt;/div&gt;

&lt;!-- #columnWrapper --&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;div id="footer"&gt;
I assume you have a footer?
&lt;!-- #footer --&gt;&lt;/div&gt;

&lt;/body&gt;&lt;/html&gt;


Though to style that with CSS, I'd have a LOT of questions -- are those white gaps supposed to be between the sections? Is it supposed to fit full screen width with the style, or should it have some other background when it doesn't fit? "stretching" is a bit vague...

Really though it's why drawing a pretty picture before you have semantic markup of your content (or a reasonable facsimile of future content) [b]and[/b] a working CSS layout is a broken approach to web development; no matter how many artsy fartsy types might claim otherwise.

*laugh* you know, looking at this I'd be tempted to see if I could style it using just background textures and then doing the gradient stuff using CSS3. I might take a stab at that for laughs.
Copy linkTweet thisAlerts:
@deathshadowJun 09.2014 — Ok, took some rewriting of the markup -- ended up DIV heavy, but also image-light since it uses just two images.

http://www.cutcodedown.com/for_others/pradW/template.html

as with all my examples the directory:

http://www.cutcodedown.com/for_others/pradW

is unlocked for easy access to the bits and pieces. I used a stock leather texture I had lying around as a alpha transparency (something I normally don't do) over the background-color but under the box-shadows. I use box-shadow with negative side margins cut-off by overflow instead of linear-gradient since that would take multiple backgrounds and would be harder to make gracefully degrade.

I opened the layout up to be semi-fluid and elastic, so it auto-scales to the user font preferences and adjusts to the available screen space, then threw a bit of responsive layout code at it too... and I added a footer so that... well, it has a footer. CSS Sprites were used to give it hover states on the social buttons, and I gave it some other hover states while at it. Also tossed a styled footer while in there.

Which kinda looks like crap with the white background -- but I assumed you were going to have a background-color or image on BODY we're not seeing... as well as a bunch of content in the header and sidebar we're not seeing either.

Naturally as most of this uses CSS3 it loses the shadows/highlights/rounded corners in IE8/earlier -- in my book "OH WELL!" -- if it still works back to at least IE7 is it really worth putting extra effort in to make it look perfect? Not unless someone is shelling out boku bucks for it. IE6 may require a few selector hacks to force a solid background color, I didn't bother testing there.

It's funny, past few days I've been playing with a similar theme colour-wise; the header and footer are supposed to be metallic copper, but the content area colors are almost the same; and here I was thinking "nobody else seems to be using these colors" ?
×

Success!

Help @PradW spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...