CSS - mainContent opdelen in 2 stukken

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Top Low-Code Developer Gezocht!

Bedrijfsomschrijving Unieke Kansen, Uitstekende Arbeidsvoorwaarden & Inspirerend Team Wij zijn een toonaangevende, internationale organisatie die de toekomst van technologie vormgeeft door het creëren van innovatieve en baanbrekende oplossingen. Ons succes is gebaseerd op een hecht en gepassioneerd team van professionals die altijd streven naar het overtreffen van verwachtingen. Als jij deel wilt uitmaken van een dynamische, vooruitstrevende en inspirerende werkomgeving, dan is dit de perfecte kans voor jou! Functieomschrijving Als Low-Code Developer ben je een cruciaal onderdeel van ons team. Je werkt samen met collega's uit verschillende disciplines om geavanceerde applicaties te ontwikkelen en te optimaliseren met behulp van Low-code

Bekijk vacature »

Jules Kreutzer

Jules Kreutzer

24/08/2010 18:27:28
Quote Anchor link
Hallo, ik heb een vraagje

Ik heb dus mijn css gemaakt, met sitebar1, sitebar2 en mainContent.

Wat ik nu wil is in mainContent 2 afbeeldingen (die naar een bestand linken als je erop klikt) naast elkaar zetten. Dit lukt me niet.

Het orginele bestand was zonder .thrColEls #mainContent-left en .thrColEls #mainContent-right.

Weer iemand hoe ik dit kan verhelpen?

Hier mijn CSS:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@charset "utf-8";
body  {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    background: #FF9;
    margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    padding: 0;
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #000000;
}

/* Tips for Elastic layouts
1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate.
2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this.
3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing.
*/
.thrColEls #container {
    width: 46em;  /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
    background: #FFFFFF;
    margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    border: 1px solid #000000;
    text-align: left; /* this overrides the text-align: center on the body element. */
}

/* Tips for sidebar1:
1. Be aware that if you set a font-size value on this div, the overall width of the div will be adjusted accordingly.
2. Since we are working in ems, it's best not to use padding on the sidebar itself. It will be added to the width for standards compliant browsers creating an unknown actual width.
3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".thrColEls #sidebar1 p" rule.
*/
.thrColEls #sidebar1 {
    float: left;
    width: 11em; /* since this element is floated, a width must be given */
    background-color: #BF9B30; /* the background color will be displayed for the length of the content in the column, but no further */
    padding: 15px 0; /* top and bottom padding create visual space within this div */
}
.thrColEls #sidebar2 {
    float: right;
    width: 11em; /* since this element is floated, a width must be given */
    background:  #BF9B30; /* the background color will be displayed for the length of the content in the column, but no further */
    padding: 15px 0; /* top and bottom padding create visual space within this div */
}
.thrColEls #sidebar1 h3, .thrColEls #sidebar1 p, .thrColEls #sidebar2 p, .thrColEls #sidebar2 h3 {
    margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
    margin-right: 10px;
}

/* Tips for mainContent:
1. If you give this #mainContent div a font-size value different than the #sidebar1 div, the margins of the #mainContent div will be based on its font-size and the width of the #sidebar1 div will be based on its font-size. You may wish to adjust the values of these divs.
2. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div.  No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends.
3. To avoid float drop, you may need to test to determine the approximate maximum image/element size since this layout is based on the user's font sizing combined with the values you set. However, if the user has their browser font size set lower than normal, less space will be available in the #mainContent div than you may see on testing.
4. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs that may occur.
*/
.thrColEls #mainContent {
  margin: 0 12em 0 12em; /* the right margin can be given in ems or pixels. It creates the space down the right side of the page. */
}

.thrColEls #mainContent-left {
    text-align: left;
    
}

.thrColEls #mainContent-right {
    text-align: right;
    margin: 0 6em 0 6em;
}

/* Miscellaneous classes for reuse */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    float: right;
    margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
    float: left;
    margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
}
Gewijzigd op 24/08/2010 18:29:54 door Jules Kreutzer
 
PHP hulp

PHP hulp

09/05/2024 03:16:38
 
Dalando De Zuil

Dalando De Zuil

24/08/2010 18:29:18
Quote Anchor link
1: Verwijder eens al die tips joh, maakt het onoverzichtelijk
2: Gebruik [.code.] tag's. zonder puntjes...
3: Voorbeeldje?
Gewijzigd op 24/08/2010 18:30:11 door Dalando De Zuil
 
Jules Kreutzer

Jules Kreutzer

24/08/2010 18:31:09
Quote Anchor link
Ja sorry wist niet hoe het moest maar heb het nu veranderd. Ook sorry voor al deze tips maar mij Dreamweaver zet deze er automatisch bij.

En wat voor voorbeeldje heb je nodig?

ik kan je wel een link geven die staat hier
Gewijzigd op 24/08/2010 18:36:38 door Jules Kreutzer
 
Jelle van der Zwaag

Jelle van der Zwaag

24/08/2010 19:04:54
Quote Anchor link
Probeer eens op een simeple html-pagina, zonder kolommen e.d., twee afbeeldingen naast elkaar te zetten met floats. Experimenteer.

Als je dat eenmaal lukt en begrijpt, probeer het dan nog eens in je oorspronkelijke css.
 
Jules Kreutzer

Jules Kreutzer

24/08/2010 20:13:33
Quote Anchor link
In een gewone html lukt het me wel, maar als ik het moet omzetten in een css lukt het me maar niet, misschien dat iemand een stukje code voor me heeft, dat zou ook al een heel stuk helpen, daar kan je ook uit leren...
 
Joakim Broden

Joakim Broden

24/08/2010 20:19:27
Quote Anchor link
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
.thrColEls #mainContent img {
    float: left;
    margin-right: 15px;
}


dan gaan alle afbeeldingen in mainContent naast elkaar staan.
 
Jules Kreutzer

Jules Kreutzer

24/08/2010 21:58:51
Quote Anchor link
Gewoon perfect! heel erg bedankt Oetzie
 
Joakim Broden

Joakim Broden

24/08/2010 22:03:32
Quote Anchor link
Let wel op dat alle afbeeldingen nu gaan floaten en een margin krijgen
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.