css adaptive, dimension control, and alignment

I am currently working on developing a responsive website. The layout includes a picture on the left side, main content in a div on the right side, and additional content below the picture (view screenshot here). I want the main content to be the same height as the photo and the div below it. Setting fixed heights in pixels is not ideal for responsiveness, so I attempted using percentages without success. Here is the code, any help would be greatly appreciated (I'm new to this).

HTML:

<div class="content">
    <div class="photo-column" style="height: auto;">
        <div class="imageBox">
            <img src="images/rikkertCC.jpg" alt="">
        </div>
        <div class="tekstBallon">
            <a href="#portolio">
                <div class="triangle"></div>
                    <div class="tb-cnt">
                        <p>More text goes here...</p>
                    </div>
            </a>
        </div>
    </div>
    <div class="tb-cnt-main">
        <h2>About Us</h2>
        <p class="postInfo"><b>Is this necessary?</b></p>
        <p>Description of the company and its goals...</p>
    </div>
</div>

CSS:

.content {
    width: 80%;
    clear: both;
    margin: 0 auto;
    margin-top: 40px;
    margin-bottom: 40px;
}

.photo-column{
    width: 33.333333%;
    height: 300px;
    float: left;
}

.imageBox {
    height:auto !important;
    max-height: 90%;
    width: 96%;
}

.tekstBallon {
    display: inline-block;
    background-color: #26a0da;
    float:left;
    height: auto;
    max-height: 16%;
    width: auto;
    max-width: 96%;
    margin-top:3.3%;
}

.triangle{
    position: initial;
    height: 15px;
    width: 25px;    
    margin-left:5%;
    background-color:#26a0da;
}

.tb-cnt-main{
    padding: 3% 4%;
    color:#FFF;
    font-family: Segoe ui;
    display: inline-block;
    background-color: #323232;
    width: 58.6%;
    float:right;
}

Answer №1

By enclosing all 3 elements within another container, it is possible to define the height of your primary content as 100% of that particular container. This method is typically necessary when combining static and relative heights.

Make certain to select a display type that will automatically adjust to accommodate the content within.

Answer №2

I didn't have a chance to review all your code, as I'm currently in class. However, if you're looking to make your website responsive, you can incorporate the following code at the end of your CSS:

@media screen and (max-width: 568px) {

.classToChange {
  color: red;
}

}

This code will come into effect when the screen width is 568px or less, applying the specified CSS changes.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The issue with the JQuery Cookie Plugin is that it is unable to function properly due to the

Although I know there are many similar questions out there, please bear with me. I am not as proficient in JQuery as I am with HTML/CSS, and this is my first time using cookies. On my website, I have a green banner that should disappear when the user click ...

Having trouble with the Javascript denial of submit functionality?

I'm dealing with an issue in my code where form submission is not being denied even when the input validation function returns false. I can't figure out what's causing this problem. <script> function validateName(x){ // Validati ...

Node.js error: HTML audio file returns 404 on server but plays fine when accessed directly as an HTML file

I'm facing an issue with an HTML page that contains an autoplay tag for a song (the file is in mp3 format). When I open the page as a local file on my Mac, the song plays fine. However, when I try to run it using a node.js file with socket.io, the son ...

How can a button be linked directly to a particular list item?

I currently have a HTML tag within my React application that looks something like this: <ul> <li> Item 1 <button> Delete </button> </li> <li> Item 2 <button> ...

What could be causing this `even` function to malfunction when utilizing getElementById?

Need assistance with utilizing document.getElementById? Let's take a look at this code snippet: function even() for (i = 0; i < 10; i++) { if (i % 2 == 0) { alert(i); } } document.getElementById("even").innerHTML = i + &apos ...

Include dropdown lists for selecting the year, month, and day on a web page

Is there a way to implement a dropdown style date selector that dynamically updates the number of days based on the selected year and month using JavaScript? For example, February 2008 has 29 days, April has 30 days, and June has 31 days. Any suggestions ...

What are the best ways to ensure my website looks great on both desktops and phones? I'm considering using media queries,

My website needs to be made responsive for both desktop and mobile devices. With around 200 lines of CSS code, I'm wondering how best to achieve this without having to add another 200 lines for media queries. Any simple solutions or advice on the most ...

Angular Material's md-content utilizes its own vertical scroll bar

Struggling with a problem while using Angular 1.* and angular-material. The issue arises when dealing with views that plug into <div ng-view></div> and md-content. If the height of the view exceeds the viewport, it leads to the appearance of t ...

When the user clicks the back button in AngularJS

After searching extensively, I have yet to find a straightforward solution to my issue. The problem lies in a search/filter field that filters the page based on user input. While this filter works efficiently, it clears whenever a navigation item is clicke ...

Select Year - Calendar View

I am currently making adjustments to a basic datepicker. I am looking to only include the Year dropdown (Month is not necessary). https://i.sstatic.net/AEpaj.png I have attempted to eliminate the Month dropdown by applying the following CSS: select.cus ...

Tips for stretching the div#header2 across the full length of div#header1

Code: #header1{width:100%;} #header2{ position: absolute; top: 0px; left: 0px; width: 75px; height: 72px; background: url("./image.png"); background-repeat: repeat-x; background-position: -10px -180px; } <div id="heade ...

Ways to emphasize the current tab on the site's navigation bar?

Here's my question: I have a menu with different items, and I want to make sure that the active tab is highlighted when users switch to another page. I noticed that Stack Overflow uses the following CSS: .nav { float: left; font-size: 1 ...

How to apply bold styling to text with DOM Events

I am currently in the process of learning JavaScript and decided to practice by creating a text editor. The goal is to type something, click a button to change it to upper or lower case, bold, or italicize. While I successfully implemented the uppercase an ...

Pandoc fails to display SVG images when converting HTML to DOCX

I am currently utilizing pandoc for the conversion of a standalone html file (without external dependencies), incorporating all necessary css and js within the html itself. Within this HTML document, there are several svg graphs that have been generated th ...

Modify content once it has been rendered using Jquery

After loading, I want to adjust the style of a specific element. However, I am running into a null pointer issue. function loadFriends() { $("#friendsContainer").load("friends.html"); } selectCurrentSetting(); function selectCurrentSetting() { c ...

Enabling and Disabling Input based on Conditions in Vue.js

Here is an example of an input field: <input type="text" id="name" class="form-control" name="name" v-model="form.name" :disabled="validated ? '' : disabled" /> ...

Counting selected files can be done by following these steps

My form includes a simple input field like so: <input id="my_id" multiple="true" type="file" name="image_name[]" /> I need help with the following questions: What is the best way to calculate the number of selected files using jQuery or pure Java ...

How can you fix a navbar that won't stay in place?

I'm facing an issue with this example: When I scroll, the navbar moves along due to the fixed property, which affects the overall look. How can I make it disappear when scrolling, while keeping the logo intact? Can someone suggest if this layout is ...

Tips on pausing a moving image from left to right and restarting it later

Is there a way to pause the left to right moving image at the end and then restart the loop? I tried utilizing this website link for assistance: https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_animation-delay Unfortunately, I couldn't fi ...

CSS: The addition selection operator is not functioning as expected

The span's background color is not changing correctly when the radio button is changed. Why is this happening and how can it be fixed? div { margin: 0 0 0.75em 0; } .formgroup input[type="radio"] { display: none; } input[type="radio"], label { ...