coolgirl1 Posted June 11, 2012 Share Posted June 11, 2012 Hi!to a previous post I had. I talked about having trouble centering a picture and being able to add links to the left of it because the links would be pushed down. I figured out that I need to do a container. Problem is, not sure how to style it in CSSI want my link menu to be to the left and I want my image to be centered. Do I have to do a complete HTML layout or can I just contain the image?How would I go about that code wise? I know in HTML I would put< div id="container"> or <div id="content">Any help would be appreciated. Thanks. 1 Link to comment Share on other sites More sharing options...
Krewe Posted June 11, 2012 Share Posted June 11, 2012 Look at the float element for CSS.See if you can figure it out, if you can't come back .http://www.w3schools.com/css/css_float.asp 1 Link to comment Share on other sites More sharing options...
niche Posted June 11, 2012 Share Posted June 11, 2012 If your div has a width, all you need is margin: 0 auto; Link to comment Share on other sites More sharing options...
dsonesuk Posted June 11, 2012 Share Posted June 11, 2012 wrap menu links in container div, or use unordered list UL ,and float this container left. You now have 2 options, (1) Place image in a div container, and add styling text-align: center; and place this div container BELOW menu link container, because the menu container is floated left, the block element container div will merge with it and the image will be centred. (2) Make the image that is by default a inline element a block element by using display: block; make sure you have defined a width, and apply margin: 0 auto;, and place BELOW menu link container, again because it is now converted into a block element it will act as the block element container in option 1. Link to comment Share on other sites More sharing options...
eTianbun Posted June 12, 2012 Share Posted June 12, 2012 (edited) Create containers (<div>s) float one left and the other one right (making it two <div>s).EX:CSS: div#left{width:300px;height:600px;float:left;background:gray}div#right{width:900px;height:600px;float:right;background:red;text-align:center} HTML: <div id="left"></div><div id="right"><img src='image.gif'/></div> Edited June 12, 2012 by CodeName Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now