CSS Padding param is not loading - html

This is a table (tag)
Where first column holds username
second column holds content for this particular topic
I've made a css for the table and definition within should set the padding to 0.
However, I noticed padding: 0px 0px; has no effect
Browser: Chrome
CSS for the topic
.TOPIC_STYLE {
border-collapse: collapse;
border:0px solid black;
padding:0px 0px;
font-family: '华康少女文字 - Kelvin';
font-size: 18px;
color: #819FF7;
}
Here is the code for table: <table class=TOPIC_STYLE align=left>
2016-08-13 - Complete set of code is lost along with my old laptop.
Goal: Eliminate the white space in the red circle.
Other CSS I have for table:
.TOP_LEFT {
background-image: url(top_Left.png);
background-repeat: no-repeat;
}
.TOP_RIGHT {
background-image: url(top_Right.png);
background-repeat: no-repeat;
}
.VERTICAL_LEFT {
width: 150px;
height: 30px;
text-align: center;
background-image: url(vertical_Left.png);
background-repeat: repeat-y;
}
.VERTICAL_RIGHT {
width: 700px;
height: 30px;
background-image: url(vertical_Right.png);
background-repeat: repeat-y;
}
.BOTTOM_LEFT {
width: 150px;
height: 40px;
background-image: url(bottom_Left.png);
background-repeat: no-repeat;
}
.BOTTOM_RIGHT {
width: 700px;
height: 40px;
text-align: center;
background-image: url(bottom_Right.png);
background-repeat: no-repeat;
}
Solution:
Pictures was indeed used to create the border, which was unnecessary since CSS already provided border property for that purpose.
Therefore all related pictures can be shelved and use border property instead.
Similarly, border-left, right, top, bottom can also be used.
table {
border: 2px solid red;
}

Your background image isn't wide enough to cover all the space without repeating. For .TOP_LEFT, change background-repeat: to repeat-x; and edit a new image to be much taller and wider.
But if I were in your shoes, I'd just handle that effect as a border. Take off all of the background images and add these rules:
table { border: 2px solid blue; border-collapse: collapse; }
tr { border: 2px solid blue; }

Not sure why your class name has a dollar sign in front of it. Try this:
<table class="TOPIC_STYLE">

<table class="TOPIC_STYLE" align="left">
They should be look like this..Are you getting the same problem still ??

Related

background images specified in css not rendering

I have a PHPBB theme I am starting to construct. In the CSS file, I have three items--a body and two divs--with background images. The background images for the divs have ceased working in all browsers.
The site with the theme presented is here: https://www.tarazedi.com/index.php?style=7
The problem images are here: https://www.tarazedi.com/styles/wTcFresh/theme/images/site_banner.png
The CSS is located in wTcFresh/theme/.
The images are all in the same locations but there seems to be a pathing issue but is working very strangely. I have tried using both relative and absolute URLs. I have tried url(x);, url('x');, and url("x"); and also changing the other background elements. In no case have the banner and logo images started working, but the body image works fine despite being in the same place and using the same syntax. When I inspect the computed styles of the divs in Chrome the image will show as the full absolute URL correctly but the relative link links instead to tarazedi.com/images/site_banner.png which returns a 500 error because that URL is, obviously, useless. In Edge and Firefox the inspector shows the correct link to the image but still does not render.
I have cleared browser and site-side caches with each attempt I make to fix it.
I am baffled. What am I missing?
body {
color: #CCCCCC;
background-color: #000000;
background-image: url("images/bg.jpg");
background-attachment: fixed;
}
.headerbanner {
border: #009900 solid 4px;
border-radius: 40px;
background-image: url("images/site_banner.png");
background-attachment: fixed;
background-position: right;
background-repeat: no-repeat;
margin-left: auto;
margin-right: auto;
vertical-align: middle;
}
.headerlogo {
border: #003300 solid 4px;
border-radius: 36px;
overflow: hidden;
background-repeat: no-repeat;
background-image: url("images/site_logo.png");
background-attachment: fixed;
background-position: left center;
vertical-align: middle;
}
To achieve expected result,adjust background-position and it is not issue with the background-image
1.Remove background:position to see the difference
Editing it thusly fixed the problem and it now renders correctly. Thank you very much!
.headerbanner {
border: #009900 solid 4px;
border-radius: 40px;
background-image: url("images/site_banner.png");
background-position: right;
background-repeat: no-repeat;
margin-left: auto;
margin-right: auto;
align-items: center;
}
.headerlogo {
border: #003300 solid 4px;
border-radius: 36px;
background-image: url("images/site_logo.png");
overflow: hidden;
background-repeat: no-repeat;
background-position: left;
align-items: center;
}

Why doesn't my Background Image Show?

I am having trouble getting a background image to show in a div and can't for the life of me see why...
This is the structure that I have:
Folder
\style.css
\index.html
\Images
\bookone.jpg
I want the bookone.jpg file to be the background of a div.
So the CSS path would be Folder/style.css and the image path is Folder/Images/bookone.jpg. I have the below code in my html and css file but I get nothing when previewing it.
/* CSS */
.book {
height: 300px;
width: 300px;
margin: 0px;
padding: auto;
border: 1px solid #000;
}
#bookone {
background: url(..\Images\bookone.jpg) ;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
<!-- HTML -->
<div id="bookone" class="book"></div>
You should use slash (/) and not backslash (\).
You should make sure the image is in the correct path (relatively to the current css/html file).
If the images exists in the same location of your css file (or your html file) you shouldn't use the .., since it actually tells your browser to search for that image in the upper-folder.
This is the final css code you should probably use:
.book {
height: 300px;
width: 300px;
margin: 0px;
padding: auto;
border: 1px solid #000;
}
#bookone {
background: url(Images/bookone.jpg) ;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
just writing my comment as answer as this help OP to solved the problem
try url(Images/bookone.jpg) in ur css file
It appears like the image you want have as a background is in another folder away from where the CSS is. I suggest you assign the background image from the HTML code. Use the forward slash (/) and not backslash (\).
E.G
<div id="bookone" class="book" style="background: (url('/myimage/bg.jpg')"></div>
or on css
.book {
height: 300px;
width: 300px;
margin: 0px;
padding: auto;
border: 1px solid #000;
}
#bookone {
background: url(./images/bookone.jpg) ;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}

Background Image in Textbox Using CSS

Before posting it over here, I have done thorough research work on my question but I haven't found any suitable answer to it.
How do I post an background image in a textbox using CSS?
Am using IE11.
The below is the code which am using
<a href="#">
<div id="imagecontainer"></div>
<style>
#imagecontainer {
background-image: url("content\A.png") no-repeat;
background-size: cover;
background-size: contain;
width: 10%;
height: 10%;
border: 1px solid;
}
I have tried many possibilities to sort it out but am unable to. The box is going to be displayed but not the image in the backgorund in my code.
Can any of you suggest me whats wrong in it please.
if you are trying to reference a url in a different directory use the following:
#imagecontainer {
background-image: url('Images/example.jpg') no-repeat;
background-size: cover;
background-size: contain;
width: 10%;
height: 10%;
border: 1px solid;
}
Try like this: Demo
input {
padding: 9px;
outline: 0;
font: normal 13px/100% Verdana, Tahoma, sans-serif;
width: 10%;
height: 10%;
border: 1px solid;
background: #FFFFFF url('http://nettuts.s3.amazonaws.com/584_form/bg_form.png') left top repeat-x; /* make sure about the image path you mentioned is right */
}
And I didn't saw any textbox code in you HTML. As you mentioned, I showed simple example for textbox with background image. Hope this is what you want.

How can I fit a square HTML image inside a circle border?

I have a square image, and I'd like to put it inside a circle border. How can I make it so that the entire image fits instead of its corners getting cut?
.circle {
width: 200px;
height: 200px;
border: 1px solid black;
border-radius: 100px;
background-image: url('http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Ski_trail_rating_symbol-blue_square.svg/600px-Ski_trail_rating_symbol-blue_square.svg.png');
background-size: contain;
}
Here it is on jsfiddle.
You need to shrink the image slightly to make it fit within the circle. To calculate the exact size, divide the diameter of the circle by sqrt(2). In this case, 200px / sqrt(2) is about 141px.
Thus, add the following properties:
background-size: 141px;
background-repeat: no-repeat;
background-position: 50%;
JSFiddle
Note that the blue block doesn't touch the circle because the image has a transparent border.
UPDATE: As cassiorenan correctly points out, using a percentage allows the image to automatically scale if you change the size of the circle. Since 1 / sqrt(2) = 0.707..., you can use 70.7% instead of 141px:
background-size: 70.7%;
Change the background size to a percentage(So it will still have the same relative size ragardless of you changing the circle's width/height.) and center it. While you're at it, tell it to not repeat.
On your particular case, this code works:
.circle {
width: 200px;
height: 200px;
border: 1px solid black;
border-radius: 100px;
background-image: url('http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Ski_trail_rating_symbol-blue_square.svg/600px-Ski_trail_rating_symbol-blue_square.svg.png');
background-size: 90%;
background-repeat: no-repeat;
background-position:center;
}
Edit: Fixed code formatting.
As I said in my comment you must remove transparent border/space around the image or if you don't wanna do that then use this CSS
.circle {
width: 200px;
height: 200px;
border: 1px solid black;
border-radius: 100px;
background: url('http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Ski_trail_rating_symbol-blue_square.svg/600px-Ski_trail_rating_symbol-blue_square.svg.png') center;
background-size: 130%;
}
Give the background a size like background-size: 100px; then position it in the center of the div and tell it not to repeat:
background-size: 100px;
background-position:50%;
background-repeat:no-repeat;
The coding should now look like this:
.circle {
width: 200px;
height: 200px;
border: 1px solid black;
border-radius: 100px;
background-image: url('http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Ski_trail_rating_symbol-blue_square.svg/600px-Ski_trail_rating_symbol-blue_square.svg.png') ;
background-size: 100px;
background-position:center center;
background-repeat:no-repeat;
}
JSFiddle Demo

how to position a css sprite as background for another class

Sorry if the layout of the question seems weird, I've wrote this question now for about 10 times over and over again in this editor, resulting always in getting an error message "unformatted code found etc." - so I removed all the code and placed picture examples. (2 hours for a simple question)
Hello folks!
I do have a .png image, containing several icons that works as CSS Sprite.
The creation of each CSS class for that is no problem as I use a generator for that. (works like a charm)
The problem is, that I want to use, for example: The created .iconInfo_32 class, as background property for another css class.
What I want to achive?
Simple said, a custom css - messagebox, with an icon on the left side.
The icon itself is in original a sprite containing multiple icons.
That's where the problem starts.
What I have
The Icons
(thats one PNG)
The Icon I want to use
How the result should look like
How it actually looks
Use another div, in a div
Yes, that would work - but I'd like to have "one" css class, without the need to put always a div, into another div, say where the position should be and so on - also I had problems with the position of the div.
I've provided a source example, hopefully this will help being able to understand my question and my goal.
Excuse me if the layout of my question is unusual and unpleasent, I would have done it in another way, but the editor just won't let me
Source
HTML
<div class="warning_without_sprite">
This is a DIV container<br />
showing an error message with the use of 'close_32.png' as Icon. (No Sprite)
</div><br /><br /><br /><br />
<div class="warning_with_sprite">
This is a DIV container<br />
showing an error message with the use of 'icons.png' as Icon. (Sprite)
</div>
CSS
<style type="text/css">
.iconInfo_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -0px -0px; }
.iconOk_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -32px -0px; }
.iconAdd_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -64px -0px; }
.iconClose_2_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -96px -0px; }
.iconClose_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -128px -0px; }
.iconDelete_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -160px -0px; }
.iconDownload_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -192px -0px; }
.iconHelp_32 { width: 32px; height: 32px; background:url(images/icons.png) no-repeat -224px -0px; }
.warning_without_sprite {
border: 1px solid;
padding: 10px 10px 10px 50px;
background-repeat: no-repeat;
background-position: 10px center;
float:left;
color: #D8000C;
background-color: #FFBABA;
background-image: url('images/close_32.png');
}
.warning_with_sprite {
border: 1px solid;
padding: 10px 10px 10px 50px;
background-repeat: no-repeat;
background-position: 10px center;
float:left;
color: #D8000C;
background: #FFBABA url('images/icons.png') no-repeat -128px -0px;
}
</style>
>> Download as RAR. <<
It's because you've set it as a background-image across the whole <div> element and because the sprite contains multiple images it will show them all. You can't specify how much of that sprite to show.
You'll have to insert a <span> element into your <div>. This will allow you to specify the size of the span and position it relative to your div container.
<div class="warning">
<span class="warning_with_sprite"></span>
This is a DIV container<br />
showing an error message with the use of 'icons.png' as Icon. (Sprite)
</div>
CSS:
.warning_with_sprite {
position:absolute; left:16px; top:16px;
background-repeat: no-repeat;
background-position: 10px center;
width:20px; height:20px;
background: url('http://i5.minus.com/id1CYq.png') no-repeat -133px -2px;
}
.warning {
float:left;
color: #D8000C;
border: 1px solid;
position:relative;
padding: 10px 10px 10px 50px;
background: #FFBABA;
}
See a demo here
Note: you'll have to change the image back to your sprite and the top, left, height and width properties will have to change inline with your requirements