CSS - Positioning Images And Text Within A Div
I'm trying to position some things inside a DIV. Here's the basic layout:
What I did was put them in DIVs position them within the "parent" DIV relative to the upper left. Doesn't seem to work, so I'm doing something wrong. Image One is easy, but the text and Image Two I just don't seem to grasping. I've looked at the Floatutorial, I'm not grasping it, or the answer isn't there. Should the text block and Image Two be within a separate DIV? Similar TutorialsHi, i'm trying to align two images in a box, and can't figure out the best way to do it. Basically i have an id: #leftcol { background:url(images/home_page/banner-bg.gif) top left repeat-x; width:84%; border:1px solid red; } then i have two images on that i want aligned top left and the other that i want aligned top right. i managed to get the top left one in: <div id=leftcol> <img src="images/image.jpg" width=559 height=88 border="1"></div> now where and how do i put the second image in, to get it to align top right? thanks, Heidi I have a web page with three images: (http://www.stud.ntnu.no/~rasmusal/). The first one is the background image (backcenter.jpg) which repeats as it is supposed to. Then I have the image on the top (backtop.jpg) which is centered at the top and shows ok in FF but is one or to pixels off in IE. The last image is backbottom.jpg which should be at the bottom of the page, but for some reason is below the top-image. Could someone tell me how to position the images so that they are all vertically centered (in at least FF and IE), and so that top is at the top and bottom is at the bottom? The css is as follows: body { color: #444; background-color: #fbfbfb; background-image: url(backcenter.jpg); background-position: top center; background-repeat: repeat-y; margin: 0px; padding: 0px; } #topImage { background: url(backtop.jpg) center no-repeat; margin: 0 auto; width: 800px; height: 350px; } #bottomImage { background: url(backbottom.jpg) center no-repeat; margin: 0 auto; width: 800px; height: 50px; } And the html: <body> <div id="container"> <div id="topImage"> </div> <div id="bottomImage"> </div> </div> </body> Thanks!!! I have a table with a width of 100%. At the right end, I want to position an image with its top right corner relative to the top right corner of the table. I cand quite figure out how to do it with CSS. Can someone give me a hint? I redid a webpage and I am not using table, everything displays properly except the last two images, one has different height... I need to align the last one on top. Since I'm new to css, I don't know how I could do float:top;.. view what I'm talking about. hopitel.com/temp/test.html Thanks. I have a number of icons. - back button - print button - next button I want to display them all on the same line. I want the back button to be placed on the far left while the other two on the far right. I have experimented quite abit with trying to get this to work, and have managed to sort of get it right by using left padding. However, I know this is a rubbish way of doing it as depending on the screen size will depend on where the right hand icons appear. I did think I would just use tables, but figured someone here maybe able to help me out. Ive got three divs all nested in a row. The idea is to have the main div (body tag) contain the background image that composes the color. Then the next div contains the upper left hand image and the next div contains the lower right hand image. The problem is this. When I specify "top-left" for the image the image is positioned to the top left. When I specify "bottom-right" for the image in the next div, instead of going to the bottom right, the image ends up all the way over on the top left. why is that? here are my three divs: Code: body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; margin: 0px; border: 3px solid black; background-image: url(http://www.doublethinkdesigns.com/pics/dtdbg.jpg); background-repeat: repeat; /* */ } div#outer { margin: 0px; border: 3px solid white; background-image: url(http://www.doublethinkdesigns.com/pics/upper-left-fan.gif); background-position: top-left; background-repeat: no-repeat; } div#inner { margin: 0px; border: 3px solid black; background-image: url(http://www.doublethinkdesigns.com/pics/lower-right-samurai.gif); background-position: right; background-repeat: no-repeat; } I have worked out a section banner. There is one for each section in a column of 4 or 5. The buttons on the left call a JavaScript that move DIVs up and down, reordering the content as the user wishes. Anyway, I'm having trouble figuring out how to make the center section where the Title is, non-fixed (expand to fit the space). I'd like it to spread out to as wide as the container allows, minus the width of the left and right ends, of course. See the actual thingy on a test page he Siliconsatan Here's the styles: Code: <style type="text/css" media="all"> .col_tab_left { position: relative; width: 36px; height: 30px; left: 0px; top: 0px; background-image: url(./images/col_tab_left.gif); } .col_tab_middle { width: 430px; height: 30px; position: absolute; left: 36px; top: 0px; background-image: url(./images/col_tab_bg.gif); text-align: center; } .col_tab_right { width: 26px; height: 30px; position: absolute; left: 466px; top: 0px; background-image: url(./images/col_tab_right.gif); text-align: center; } .col_tab_title { font-family: tahoma,verdana,arial,helvetica,sans-serif; font-size: 10pt; letter-spacing: .05em; color: #003366; font-weight: bold; line-height: 30px } .col_block_up { width: 36px; height: 30px; border: 0px solid #003366; left: 5px; } .col_block_down { width: 36px; height: 30px; border: 0px solid #003366; position: absolute; left: 13px; top: 0px; } .col_image { position: relative; display:block; left: 6px; top: 12px; } </style> Here's the html: Code: <div class="col_tab_left"> <div class="col_block_up"> <img onclick="MoveBlock('ys101','bizJournalCity','Up');" class="col_image" src="images/block_up2.gif" width="11" height="11" border="0" alt="" alt="Move section up" title="Move section up" style="cursor:pointer;" /> </div> <div class="col_block_down"> <img onclick="MoveBlock('ys101','bizJournalCity','Down');" class="col_image" src="images/block_down2.gif" width="11" height="11" border="0" alt="" alt="Move section down" title="Move section down" style="cursor:pointer;" /> </div> <div class="col_tab_middle"><span class="col_tab_title">Business Journal News</span></div> <div class="col_tab_right"></div> </div> It looks like this: I'm very new to css positioning so this might be an easy question... What I'm trying to do happens to position properly in IE6 and Firefox like so: http://whythrowchip.go.dyndns.org/atx1.jpg But it doesn't come out properly in IE 5.X , it looks like this: http://whythrowchip.go.dyndns.org/atx2.jpg It's know it's probably not an IE 5.X quirk, I guess I'm not supplying the right information to tell it to stay where I want it... So what's the best way with CSS to make a row of images that lines up side by side and won't break to the next line? Here is my code now as it stands (I put in three dots in a row in a couple places so there wouldn't be quite so much code pasted here): Code: from main page: <div id="wrapper"> <div id="top_banners"><img src="logo.jpg" width="391" height="106" border="0"><img........</div> <div id="top_menu">img src="menu1.jpg" width="150" height="20" border="0"><img.........</div> <div id="content"> <p>Some filler text in here</p> <p>Some filler text in here</p> </div> </div> entire external style sheet: body{ background-color:#666666; color:#000000; font-family:Verdana, Arial, Helvetica, sans-serif; margin: 0; padding: 0; text-align: center; } #wrapper{ padding: 0; margin-top: 10px; margin-bottom: 10px; margin-right: auto; margin-left: auto; background-color: #EAEAEA; border: 1px solid #000000; width: 750px; text-align:left; } #top_banners{ margin: 0; padding: 0px; height: 106px; } #top_menu{ margin: 0px; padding: 0px; height: 20px; } #content p{ font-family: Verdana, Arial, Helvetica, sans-serif; margin-left: 20px; } any help would be greatly appreciated ps:the buttons in the second row are rollover gif images done with Dreamweaver, not that that should matter I guess Hey guys i have some image layout problems with my images on safari and firefox on Mac only. Firefox and safari on PC seem fine but its only happening on Mac. The positioning of the images have moved dramatically. Not sure how to fix it CSS is validated and so is xhtml strict Hello all, My second post . I have a div box with text in it. It looks fine in ie, but the text drops when viewed in mozilla. I have highlighted the border for clarity and want the text to remain directly underneath. I have tried adding styles to mainsection, the div in question, and also the p text attribute, with no joy. As with my last problem I am sure the solution is a simple style, but I can't find it. Any help would be much appreciated. thanks Solar. html page: http://darkspeed.atspace.com/Textest.htm CSS link: http://darkspeed.atspace.com/txtstyle.css thanks again. Hi, I am having a problem with positioning of text within a div. The CSS for my div is: #menuItem { background-image: url('../../images/menu_bg_off.jpg'); width: 146px; height: 28px; font-family: Verdana, sans-serif; font-size: 14px; font-weight: bold; background-repeat: no-repeat; } <div id="menuItem"><img src="images/spacer.gif" width="33" height="1" /><a href="">Home</a></div> The problem lies in getting the text to appear in the middle of the div. I've tried using padding-top: to nudge it down a bit, but that extends the height of the div.. which I don't want to happen. I have a bunch of these lined up vertically (forming a menu) and I don't want any space between them. margin-top: also adds this unwanted space. As you can see I'm using a transparent spacer image to nudge the text horizontally to where I need it to appear, which works. My question is.. how do I position the text vertically to where I want it to appear inside the div? Hi Basically i have positioned some text on my site in the place i need, and it looks fine while the browser is maximised. But when i resize, the text moves to accommodate. Is there anyway i can have the text in the right place, but not move when the browser is resized? Thanks this is the first time im making a CSS website. w3schools.com really is a big help, but i came upon a problem. on the layout, on the upper left, i got my main menu. i positioned some text there with this code in <head> Quote: h1 { position: relative; top: 46px; left: 135px; font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; } h2 { position: absolute; top: 63px; left: 135px; font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; } ( as u can see, i tried "relative" but it doesnt work ) and then typed the links of the menu like this: Quote: <h1><a href="index.html">Home</a></h1> <h2><a href="aboutus.html">About Us</a></h2> ect. but when i rezise the browser or take a different resolution, then the text also moves along. the text doenst stay on its place on the menu. for example, if i make the length of the browser smaller, then the text moves out of the menubox, to the right. i hope u understand this. how can i make sure that the text will always stay on its place, on every browser size/resolution? Hello, If you go to http://tombraiders.net/katie/sid/index.html User: letme Pass: in you'll see that the body text is shifted halfway down the page as well as the menu. Anyone know how I can fix this? Also, how can I fix the rollover for the menu? I don't want the rollover coloured square to be so long. Thanks! My problem is with 2 textfields that I am using css to text attributes, all is well in IE, but in netscape and firefox the letters q,y,p the bottoms get cut off. Any suggestions greatly appreciated. here is a link to the page i am working on http://www.cfwilson.com/365c/index.htm Charles I'm pretty new to CSS so bear with me if this is a silly question. I want to go totally CSS and 0 tables. 1 problem that I've been having with my site is that I have several forms for data entry. These are of course done in 2 column tables, label in the 1st column, text box in the right. The problem I'm having is that I cannot get the text boxes to line up properly using CSS. I am trying a test page simulating a login page. But since the words Username and Password are different lengths, the left edges of the text boxes don't line up evenly. What is the best technique to get CSS to display 2 columns like a 2 column table where the first 'column' contains a text label and the 2nd column has the input boxes aligned nice and neat? hey all, i'm trying to figure out how to position text in an h1 tag that uses a background image, without adding extra markup. i just need it 15px from the left of the image, and 10px from the top. here's the css for the h1 tag: Code: h1 { height:50px; width:100%; background:white url(images/h1_background.gif) no-repeat left; margin-top:12px; color:white; font-size:11pt; } and the html is just; Code: <h1>welcome</h1> thanks! Its been a long time now and I am finnaly getting back into website desiging. I am doing a simple coding but I am having a hard time trying to figure out how to do the following. I want to create a table but using only divs. So basically I am going to have a parent div acting as the whole table then sub-div acting as each row, and within those divs there will be more divs acting as each cell. But I can't figure out how to make each cell be right next to each other instead of on the next line. How do I make it look like below: |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| |<div>| Also, what CSS properity do I have to use so that the content of each cell will overlap with all th surrounding cells? By overlap I mean so they will be touching each other. Hi Guys, Basically, I have Text in a content box, all fine and dandy, this content box has a fixed width and an expanding height depending on supplied content. I now need 2 further divs, one of which floats to the right, and positioned at the top of this content div, the other also floats right but needs to be alligned bottom. Ive tried absolutes with content being relative but although this does solve the positioning problem, obviously the content text will not wrap around the divs. ------------| ------------| ------------|_______| --------------------------- ------------------ ---------------------- ---------------------------- ------------------------ -----------| -----------| -----------| -----------|_______________| Basicaally like above (sorry, cant screenshot the project im working on :]) Code: <div style="width:591px; position:relative; z-index:1;"> <div style="width:150px; height:100px; float:right;"> ZZZZZZZZZZZ </div> <div style="width:150px; height:100px; float:right;"> ZZZZZZZZZZZ </div> <div style="width:291px; height:100px; float:left;"> asfasfasgsdgdsdbn gksdjbgvsdb gjkdgkjsdb gkjsdbgksd jb gjksgsd dkj kasfasfasgsdgdsdbn gksdjbgvsdb gjkdgkjsdb gkjsdbgksd jb gjksgsd dkj kasfasfasgsdgdsdbn gksdjbgvsdb gjkdgkjsdb gkjsdbgksd jb gjksgsd dkj k </div> <div class="clear"></div> </div> |