What is the process for creating a styled container with a title using css?

Trying to create a customized box with CSS, my code is as follows. Some attributes like width and height have been omitted due to restrictions on characters.

.sponsor_info {
  border-radius: 10px;
  border: 1px solid #eeeeee;
  width:200px;
  height:50px;
  padding: 0px;
}
.sponsor_info .headbar {
  border-radius:10px 10px 0px 0px;
  width:200px;
  height: 40px;
  margin-top: 0px;
  background-color: #8BBE26;
}
.sponsor_info .headbar p {
    font-size: 20px;
    font-family: arial;
    color:white;
    line-height: 100%;
    margin-left: 3%;
    margin-top:0px;
}
<div class="sponsor_info">
  <div class="headbar">
    <p>Sponsor Info</p>
  </div>
</div>

The result shows some space between the outer grey border and the inner green bar which I can't explain.

Answer №1

.sponsor_info {
  height: 200px;
  border-radius: 10px;
  border: 1px solid #eeeeee;
  padding: 0px;
}
.sponsor_info .headbar {
  height: 100px;
  border-radius: 10px 10px 0px 0px;
  margin-top: 0px;
  background: #8BBE26;
}
.sponsor_info .headbar p {
  line-height: 100px;
  margin-left: 3%;
  margin-top: 0px;
}
<div class="sponsor_info">
  <div class="headbar">
    <p>Sponsor Information</p>
  </div>
</div>

Answer №2

modify to: .partner_details .topbar p { line-space: 110%; padding-left: 4%; padding-top: 2px; }

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

exclude the outer border from the last row of the table

Is it possible to create a table with only an outer border and exclude the bottom row, so that the bottom border of the second last row gives the appearance of being the final row? I am limited to using CSS as this is on Wordpress and I cannot make changes ...

The correct way to link a separate CSS stylesheet called "stylesheet" to an HTML page is by using the proper syntax

How can you correctly link a CSS file called "stylesheet" to an HTML page when both files are located in the same directory? ...

Tips for changing the <title> in an AngularJS one-page application

I am working on a single-page AngularJS application. The index.html file is structured as follows: <html ng-app="myApp" ng-controller="MyCtrl as myctrl"> <head> <link rel="stylesheet" href="my-style-sheet.css"> <title>{{ ...

Preventing the <img> element from being selectable and draggable simultaneously is effective in Firefox, but not in Chrome or Opera

I have a picture that I want to render both unselectable and undraggable. (This is not an attempt to prevent users from copying) To accomplish this, I can: Add a .noselect class to the <img> tag. As recommended here. Disable pointer-events. (I am ...

Clicking on the mail icon will open the mail with the associated mail id

https://i.sstatic.net/6TLpN.pngWhen the mail icon is clicked, the mail will open with this email address. I am currently working on a project where clicking the mail icon will redirect to the mail signup page with the corresponding email address. In the ...

Reducing the gridview size with the help of the Bootstrap framework's stylesheet

Seeking advice on adjusting the size and alignment of a Gridview in asp.net web forms using bootstrap stylesheets. Here's the code snippet in question: <table class="table table-sm" > <a ...

Is it possible to vary the font size for different fonts within a single page?

Imagine using Helvetica for English text and a unique, exotic font (from an ASCII perspective) for another language on the same page. Even with the same font size, one font may appear larger to the eye. Is it possible to specify different font sizes for ...

"The JavaScript form appears to be malfunctioning as it is unable to calculate results based on

I'm currently working on a JavaScript form that aims to calculate the feeding volume based on various input factors such as feed type, number of feedings per day, target protein intake, current protein intake, and patient's weight. Although the ...

Unusual layout issues arise when combining images and text

Check out this jsFiddle My goal is to display images and text side by side in a horizontal layout. The text sections are using the jQuery Cycle Lite Plugin to cycle through a list of words. However, when you view the provided jsFiddle link, you'll no ...

GWT integration for TinyMCE

I've been attempting to incorporate TinyMCE with GWT's RichTextBox, but so far I haven't had any luck. The issue seems to be that GWT turns the Rich text area into a #document, rather than a standard textarea in HTML. Does anyone know how to ...

Unable to remove both top and bottom drop shadows

Even after using the code below, I am still unable to remove the small drop shadows at the top and bottom. How can I get rid of them completely? div#inner_container { width: 960px; margin: 0 auto; background-color: rgb(255, 255, 255); box-shadow:0 9 ...

Is there a way to eliminate the bottom border on the active navigation tab?

Here's the information I've gathered: Below is a snippet of code that I have: .nav-tabs { border-bottom: 3px solid #3FA2F7 !important; } .nav-tabs .nav-link { color: #02194A; font-size: 13px; padding: 12.5px !important; } ...

The alignment of Bootstrap's Tabs is not centered as expected

I'm having trouble aligning the tab list to the center. The image below shows that it's currently shifted to the left. I've already included the Bootstrap class center-block, but it doesn't seem to be working. Can anyone help me out wit ...

What is the best way to align text in the center based on a specific portion of the content?

I'm working on an inline flex div where I want to create a unique effect using the words wrap and the div overflow. As the window is resized, some of the words in the sentence will disappear, altering the meaning. The width will determine the result: ...

Tips on retrieving an object in a JavaScript function through an HTML event

The js function code is as follows: //Assigning the index of theater array to a variable $scope.setTheaterValue = function(name) { var index = $scope.path.map(function(s){return s.name}).indexOf(name); $scope.path = $scope.path[index]. ...

Adding new rows and columns to a table in Vue using scoped CSS styling

Trying to populate a table with rows and columns programmatically by using this code: addContentToTable(type) { switch (type) { case "row": let numOfColumns = this.$refs.table.rows[0].cells.length; let row = this.$refs.table.insertRow(-1 ...

Adjust the wait time for sliding on the jQuery rcarousel

I am currently utilizing rcarousel for my website and I would like to adjust the duration of time that each slide is displayed. At the moment, each slide stays up for just a few seconds, but I want to extend this so that each slide remains on screen for at ...

The proximity between two columns of HTML elements is not closely aligned

Currently, my web app has two columns when the screen size is big enough. https://i.sstatic.net/aQPlF.png The spacing between the elements in the left column and the one below it is causing an issue that I want to address. .thumnnail { display: inl ...

Creating a 3-row design with a customized login box using HTML elements, div blocks, and CSS

I would like to use HTML, CSS and DIVs to create a 3-row layout similar to the one shown here. Specifically, I want to include a signin-box with a fixed width in the top right of the first row. This is what I have tried: <div id="container"> & ...

Display items inside containers using angularjs ng repeat and bootstrap styles, however, the layout is not being rendered correctly

I am struggling to display products in boxes on my ecommerce website, similar to how they appear on other platforms. Although I am utilizing AngularJS ng-repeat and bootstrap classes, the layout of the products is not coming out as intended. Take a look ...