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.

Positioning problem

Featured Replies

How do I position a link with decoration within a DIV below an h2 tag and li's?

 

For example I have 3 DIVS next to each other that are 320 X 400 deep each with a h2 followed by ul, li and at the bottom of each DIV i want to place a link that simply says 'Lets get started'

 

Do I use padding or margins for this or is there another way? At the moment it just overlaps the bottom of my list.

I don't quite understand. If you place the link after the list it should appear at the bottom of the div unless you have done any other positioning to tell it otherwise.

 

If the div isn't tall enough then you should increase the height, or just let it automatically extend with no height specified.

 

I may have got the wrong end of the stick here though.

  • Author

thanks for the response,

 

This is my html

 

 

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link href="css/main.css" rel="stylesheet" type="text/css"/>
</head>
<body>

<div id="header"><address class="address">Keystone IMC Limited<br/>2 Deben Mill Business Centre<br/>Old Maltings Approach<br/>Woodbridge<br/>Suffolk<br/>IP12 1BL<br/>Tel. 01394 389449</address></div>
<div id="intro"><h1>Mortgage Advice</h1><p>Keystone IMC Ltd, (Independent Mortgage Consultants), are a mortgage brokerage, mortgage consultants or mortgage advisors. In fact there are many titles that we may be referred to as but essentially if you are buying or remortgaging a property and you need a mortgage then you should speak to us. At Keystone we are able to give advice and make a reccomendation and the most suitable mortgage for you.</p><p>We built this site specifically to aid us whilst we are chatting to clients face to face or over the phone. The aim of this site is to enable the visitor to easily navigate through the <span class="changethis">NEED A WORD</span> of mortgage advice using our plain easy to follow guides.</p></div>
	<div class="container">
		<div class="col">
		<h2>Understanding Mortgages..</h2>
		<ul><li>INTRODUCTION</li><li>REPAYMENT METHODS</li><li>UNDERSTANDING INTEREST</li><li>INTEREST RATE SCHEMES</li><li>YOUR MORTGAGE TERM</li><li>GLOSSARY OF TERMS</li></ul><a href="page1.html" class="tl">Lets get started</a></div>
		<div class="col"><h2>The Process..</h2><ul><li>THE FACTFIND</li><li>YOUR BUDGET</li><li>HOW MUCH CAN I BORROW?</li><li>OBTAINING AN AGREEMENT IN PRINCIPLE</li><li>OFFERING ON A PROPERTY</li><li>THE APPLICATION PROCESS</li><li>CHOOSING THE RIGHT SURVEY</li><li>THE HOME BUYING PROCESS</li><li>SOLICITORS</li><li>POST COMPLETION</li></ul></div>
		<div class="colr"><h2>and what if..</h2><ul><li>you are unable to work</li><li>you are made redundant</li><li>you die</li><li>you are seriously ill</li><li>interest rates rise</li><li>your deal is ending</li></ul></div>
	</div>
<div id="footer">footer</div>
</body>
</html>

 

and my css

 

* {
   padding: 0;
   margin: 0;
}
body{
width:1000px;
height:800px;
margin-left:auto;
margin-right:auto;
background-color:white;

} 
h1, h2{
background-color:#99DD00;
padding-top:10px;
font-size:22px;
font-family:sans-serif formata;
color:white;
} 
p{
margin-top:10px;
margin-bottom:10px;
font-family:sans-serif;
font-size:16px;
color:#444444;
}
ul{
padding-top:30px;
}   
ul li {
font-weight:bold;
font-size:12px;
margin-top:5px;
color:#444444;
text-align:left;
padding-left:15px;
list-style-position:inside;
text-transform:uppercase;	
}
li, .square{
list-style-type:square;

}
#header{
width:1000px;
height:149px;
border-style:solid;
border-color:#99DD00;
border-width:1px;
margin-left:auto;
margin-right:auto;	
}
.address{
background-color:#99DD00;
padding:5px 5px 5px 5px;
font-family:sans-serif;
font-size:12px;
font-style:normal;
font-weight:bold;
color:white;
margin-left:800px;
margin-right:20px;
margin-top:18px;
}
.changethis{
text-transform:uppercase;
color:red;
}

.tl{
text-decoration:none;
color:white;
text-transform:uppercase;
background-color:#99DD00;
padding: 10px 10px 10px 10px;


}
#intro{
width:1000px;
height:200px;
border-style:solid;
border-color:#99DD00;
border-width:1px;
margin-left:auto;
margin-right:auto;
margin-top:5px;
}
.container{
height:400px;
width:1000px;
margin-left:auto;
margin-right:auto;
margin-top:5px;
}
.col{
width:318px;
height:400px;
border-style:solid;
border-color:#99DD00;
border-width:1px;
float:left;
background-color:white;
margin-right:20px;
}
.colr{
width:318px;
height:400px;
border-style:solid;
border-color:#99DD00;
border-width:1px;
float:left;
background-color:white;	
}
#footer{
width:1000px;
height:85px;
background-color:white;
border-style:solid;
border-color:#99DD00;
border-width:1px;
margin-top:5px;
margin-left:auto;
margin-right:auto;
}

 

There is plenty of room in the DIV from what i can see.

mteam's display: block should work because it should convert an inline element "a" into a block element and block elements normally start a new line, but the real reason you have a problem is that the "a href" link should be in a p tag or some other block element, then the display: block would not be required.

Do you want the three links to be consistently positioned in each div, regardless of the content? If so use absolute positioning.

 

To place each element absolutely within the larger divs (as oppose to absolutely relative to the window), you will need to declare the larger divs as position:relative; then declare the anchors as a block element as mentioned above, and absolutely position them within the larger divs.

  • Author

mteam's display: block should work because it should convert an inline element "a" into a block element and block elements normally start a new line, but the real reason you have a problem is that the "a href" link should be in a p tag or some other block element, then the display: block would not be required.

 

That worked great thanks Wickham.

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.