List of shapes and text items

I'm encountering some challenges with my list of shapes - could it be that I am approaching it the wrong way? I could use some guidance on what I am trying to accomplish.

Check out My Fiddle

CSS:

#circle { 
   height: 120px;
    width: 120px;
    border-radius: 60px;
   background: #3B5163; 
   -moz-border-radius: 60px; 
   -webkit-border-radius: 60px; 
}

#tablet{
    width: 295px;
    height: 354px; 
    background: #3B5163; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px;
}

HTML:

<div style="width: 1000px; margin: 0 auto; padding: 0 0 0 0;">



<ul>

<li style="display:inline;"><div id="circle" style="float:left;"></div></li>

<li style="display:inline;"><div id="circle" style="float:left;margin:  0 25px 0 25px;""></div></li>

<li style="display:inline;"><div id="tablet" style="float:left; margin:  -100px 25px 0 25px;"></div></li>

<li style="display:inline;"><div id="circle" style="float:left;margin:  0 25px 0 25px;""></div></li>

<li style="display:inline;"><div id="circle" style="float:left;"></div></li>

</ul>



</div>

Upon reviewing my code and fiddle, you can see that it aligns correctly. I would like to insert an icon (which is a span) in the center of each shape and also a word beneath each one. However, when I add elements like this, it completely disrupts the layout. Perhaps I have approached the design incorrectly?

Answer №1

If you haven't provided the dimensions of the images you plan to insert, I can offer the following suggestions: Modify the CSS code as follows:

#circle { 
   height: auto;
    width: auto;
    border-radius: 50%;
   background: #3B5163; 
   -moz-border-radius: 50%; 
   -webkit-border-radius: 50%; 
}

#tablet{
    width: auto;
    height: auto; 
    background: #3B5163; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px;
}

Furthermore, consider using display: block and then float: left. If I'm incorrect, please correct me—this method allows CSS to view objects as blocks and lets you arrange the boxes to stack to the left or right with 'float:'. (If you don't specify float, they will naturally stack vertically) You may also want to experiment with an absolute positioning technique alongside these adjustments.

Answer №2

Hey there! If you're looking to achieve a specific style, check out this example: http://jsfiddle.net/29NF3/2/

Include the following CSS:

#circle { 
   height: 120px;
    width: 120px;
    border-radius: 60px;
   background: #3B5163; 
   -moz-border-radius: 60px; 
   -webkit-border-radius: 60px; 
}
#circle span {
    clear: both;
    display: block;
    text-align: center;
    vertical-align: middle;
}
#tablet{
    width: 295px;
    height: 354px; 
    background: #3B5163; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px;
}
.text {

    display: block;
    text-align: center;

}

See the updated demonstration here :- http://jsfiddle.net/29NF3/5/

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

Error 404 - CSS file missing: encountering a 404 error while attempting to execute Flask code

Hello there! I'm still getting the hang of programming, especially when it comes to web development. Recently, I encountered an issue with my CSS file - whenever I link it to my HTML and run the Python code, I get an error saying that the CSS file can ...

Is there a way to change the background color of product blocks on Shopify in a dynamic

Is there a way to customize the background colors of product blocks on Shopify by modifying the shop code? Take a look at this example: Mockup showing alternating block backgrounds Currently, all product blocks in the grid have a black background with wh ...

Creating CSS styles to ensure text takes up the largest size possible without wrapping or extending beyond the screen borders

Looking for a way to display text at its maximum size without any wrapping or overflowing the screen? I attempted using @media and adjusting font-size, but things got too complex. My goal is to have the text on example.com displayed at the largest possible ...

"Enhance your browsing experience with Chrome by automatically changing the background when

I am currently using Chrome with a CSS3 background. <h4 class="title-name clearfix"><a href="****************">Fairy Tail - LUCY</a> </h4> My issue is that when I hover my mouse over the title, the ba ...

Encountering a NullPointerException while trying to load a resource from a directory that is not within

I'm working with JavaFX and trying to incorporate a CSS file into my scene. scene.getStyleSheets().add(Main.class.getResource("res/application.css").toExternalForm(); An NPE is being thrown. I suspect it's because the css file isn't locate ...

Struggles with implementing CSS Grid's dynamic column heights and expanding rows

Linked partially to Removing empty space in CSS Grid, with specific adjustments I am aiming for. Essentially, I want my rows and columns to expand and contract based on the content present. In this CodePen example, you can observe that the content of the ...

Differences Between Mobile and Desktop Browser Media Queries

As I work on creating a responsive website, I have come across various examples of sites that adapt well to both desktop and mobile browsers. Currently, my stylesheet setup includes different media queries for various screen sizes. However, I've notic ...

Is there a way to spin these hexagons around?

Hey there, I need some assistance with a problem. I have to rotate these three hexagons slightly, about 15 degrees or so. The catch is, it needs to work in Internet Explorer only. I've been struggling with this all day and it's getting ...

Utilizing JSON format, handling special characters, and storing data in a database

My friend approached me with a question and although I wanted to offer immediate help, I realized that seeking advice from others may provide better solutions. Situation: Imagine there is a Form that includes a RichText feature: DHTMLX RichText (). This R ...

Selecting items from a list at random using the power of math.random() and math.floor()

When attempting to randomize the popping of elements in a list stored in the baby variable, only baby[1] is being popped. How can I make it pop random elements? <body> <h1 id="1">bebe</h1> <h1 id="2">t ...

Include a parent class within the style tags in your CSS code

Currently, I am facing an issue with a web application that I am developing. On the left side of the page, there is an editable area, and on the right side, there is a live preview. The live preview area contains an HTML file with specific fields that can ...

Is the space-between property not delivering the desired spacing?

I am trying to achieve equal spacing between list items, and I attempted the following code. ul { list-style-type: none; display: flex; justify-content: space-between; } However, it seems that this approach is not working as expected. I am confused ...

Adjust Font Size inside Circular Shape using CSS/jQuery

I have been searching for different libraries that can resize text based on the size of a container. However, my container is circular and I am facing difficulty in preventing the text from overflowing beyond the border. Below you will find a Fiddle conta ...

What is the CSS/HTML code to position text at the bottom of an image overlay in a card design?

I've been attempting to modify the justify-content in the CSS class to "flex-end" and "end," however the text is not relocating to the bottom. My suggestion is that we concentrate on the img-overlay class, as that's where we adjust the position ...

When using NVDA, the close button is being read multiple times, whereas in JAWS it is being read correctly

Here is the code for a close button within a modal pop-up: <h2 class="sc-ejdXBC byjYiM MuiTypography-root MuiTypography-h6 sc-EoWXQ kOYWJk MuiDialogTitle-root" id="popupTitle"> Default Pop-UP Title <button class="sc-dm ...

Choosing a radio button with Selenium: A step-by-step guide

Currently, I am attempting to automate the clicking of a radio button with Selenium and Python. <input type="radio" name="tweet_target_1" value="website" class="tweet-website-button radio-selection-validate serialize-me newline-before field-order-15"&g ...

Why won't the main bar column in Bootstrap extend to the entire width of the page?

I've set up a basic row with two child columns: the sidebar column with className='col-md-2' and the mainbar column with className='col-md-10'. The parent row has a display:flex property to position the two children side by side. & ...

What is the best way to extract a number from a string in JavaScript?

There are instances in HTML files where a <p> tag displays the price of a product, such as ""1,200,000 Dollar"". When a user adds this product to their cart, I want the webpage to show the total price in the cart. In JavaScript, I aim to e ...

Divide information in the chart

<table id="tab"> <tr><td class="sub">mmmmm</td><td class="sub">jjjjj</td></tr> <tr><td class="sub">lllll</td><td class="sub">wwwww&l ...

Challenges with resizing in Bootstrap

I need assistance with my login form that is appearing in a Bootstrap modal. The modal I am using is the standard size, not the larger one. In the form, there are 2 input fields and a login button on the left side, while the right side should contain other ...