Despite having taken a course on web design, I appear to have very little practical knowledge of how to use CSS to get what I want. I think my problem is one of understand exactly what the functionality of each of these tags is, but no matter how many tutorials or other posts I read I can't seem to find out what I'm doing wrong.
Very simply: If this were to be a table, I would have two rows and three columns. In the first row would be an image, a video, and a different image. In the second row there is text, nothing, and text. The text corresponds to each of the images, so they should be lined up with the images above them. I also wanted everything centered on the page (and that's where things went wrong)
My best attempt at getting three images next to each other and centered caused the text to not go below the images. I don't know if I'm using the float style wrong or if I'm just not centering things the right way or WHAT, but if anyone can give me a pointer I'd really appreciate it. I hope I described my problem adequately.
Relevant HTML: - <div id="body">
-
<div id = "student-wrapper" class="wrapper">
-
<div id = "student-image">
-
<a href="#">
-
<img alt="Students Login" src="site images/students.png" width="300" height="190" />
-
</a>
-
</div>
-
</div>
-
<div id = "video-wrapper" class="wrapper">
-
<iframe width="560" height="349" src="http://www.youtube.com/embed/cjaeYkTyUHk" frameborder="0" allowfullscreen></iframe>
-
</div>
-
<div id = "professional-wrapper" class="wrapper">
-
<div id = "professional-image">
-
<a href="#">
-
<img alt="Professionals Login" src="site images/professionals.png" width="200" height="400" />
-
</a>
-
</div> <!-- END image div-->
-
</div> <!-- END professional-wrapper div-->
-
<div id="buffer"> </div>
-
</div> <!-- END body div -->
-
-
-
<div id = "goto-texts">
-
<div id = "student-text">
-
<a href="#">
-
<p class="goto"> Start Here! </p>
-
</a>
-
</div>
-
<div id = "professional-text">
-
<a href="#">
-
<p class="goto"> Start Here! </p>
-
</a>
-
</div>
-
</div>
-
</body>
And the CSS: - div#body{margin: 25px auto 25px auto; width:1200px;}
-
div#student-wrapper{margin-right:30px;}
-
div#professional-wrapper{margin-left:30px;}
-
-
p.goto{font-size:x-large; font-weight:bold}
-
div.wrapper{float:left}
-Nick
1 1747 Dormilich 8,658
Recognized Expert Moderator Expert
first of all, I wouldn’t use the table approach (you still have 2 rows and 3 columns). the text belongs to the according image, thus image and text should have a common container.
the only question remaining is, where should the text sit vertically. either directly beneath the image (that’s the easy option) or all on the same line.
for the latter you will have to take the image out of the normal flow, which can be done by float: or position: absolute .
Example. - <div>
-
<img src="…" alt="image 1" width="20" height="30">
-
<p>Lorem ipsum dolor sit amet.</p>
-
</div>
-
<div>
-
<iframe></iframe>
-
-
<!-- you need content inside the <div>, otherwise it would collapse -->
-
</div>
-
<div>
-
<img src="…" alt="image 2" width="40" height="20">
-
<p>Morituri te salutant.</p>
-
</div>
- /* somewhat generic selectors for testing */
-
div {
-
float: left;
-
width: 7em;
-
}
-
img, iframe {
-
position: absolute;
-
}
-
p {
-
margin-top: 3em;
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Helen |
last post by:
As soon as I float anything in a div, it is no longer held within the
div anymore. I'd like to be able to float things relative to the
element that they are contained in. Is this even possible in CSS?
I'm a table based designer from way back, so maybe this is just the
wrong approach to CSS. If this isn't actually possible, would someone
be able to tell me what I can do instead?
I don't really want to use absolute positioning because I...
|
by: Olly |
last post by:
I am using the following pure css layout with a header and footer:
http://www.fu2k.org/alex/css/layouts/3Col_NN4_FMFM.mhtml
The left column floats to the left of the main content (middle
column).
In the middle column I have 3 divs on top of each other, each of which
needs to have a border. To get the borders to display correctly in
Netscape 6 and ie5 (windows) I have to put a <br style="clear:both">
|
by: veerleverbr |
last post by:
Hi,
I have the following html:
<div id="content">
<div id="leftpart">...</div>
<div id="rightpart">...</div>
</div>
leftpart en rightpart are in the css set to float left. The content of
leftpart and rightpart div is so that both divs have different height.
|
by: meltedown |
last post by:
I would like the floating divs to float and then the header to come
after them , on the left. That's what I thought clearing the floats was
for, but in this example, the header is to the right of the floating
divs, nothing is cleared. What am I doing wrong ?
Here is the url:http://www.reenie.org/test/test5.php
Here is the code:
<html>
<head>
|
by: StevePBurgess |
last post by:
I have a website which, on the main page, has two floating divs. One
contains a list of navigation menu items and the other is themain
content of the page.
Occasionally that div that contains the menu is longer than the div
that contains the main content. This displays perfeclty well on Firefox
but on internet explorer the bottom bit of the navigation div is
chopped off so that it is the same height as the (smaller) main content
div.
| |
by: Arnost Sobota |
last post by:
Hello,
Suppose I want to play with DIVs as if they were type characters. I have
a series of fixed-height (width is of no importance) blocks which must
follow one another from left to right, with a small margin between them.
This is easily done with the CSS float:left property.
But in this context, what is the proper way to do a Line Feed/Carriage
Return?
Take a look at the code below for example's sake. I have 8 DIVs and I
want to...
|
by: yawnmoth |
last post by:
How do you get both of these div's to have a 100% width? (1):
<div style="float: left; background: black; color: white">Hello, world!
</div>
<div style="clear: both; background: blue; color: white">Hello, world!
</div>
You could set the width inside the floated div to 100% but if you do
that and if you have a floated fixed width div, the 100% width div
will appear on a new line, as demonstrated (2):
|
by: benwah1983 |
last post by:
Greetings,
Here is my problem:
The following code shows a div with two small nested divs (images with a title), then the div is closed. Another one opens and a "random text" is displayed.
<div style="width: 500px;">
<div style="float: left; padding: 20px;">
Image Title 1<br/>
<img src="test.jpg"/>
</div>
<div style="float: left; padding: 20px;">
|
by: dlite922 |
last post by:
This is just barely above my head when it comes to css.
I have a div that needs to contain rows of floating divs, but I need each row not to wrap on to the next one and continue to go right. The user will use a overflow: auto scroll to scroll to see the rest of the divs.
illustration:
# = === = = === ===
# = == = =
# == ==================
# =========
|
by: nlindsay |
last post by:
I am trying to center align 2 left floated divs within a % width background. I know that setting the wrapper div to a fixed width works, but can it be done with a fluid background? (basically I want 2 fixed width divs to center on a background image that stretches across the whole screen).
thanks
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |