
## closest {#str}

Returns the closest ancestor element (or the element itself) that matches the specified CSS selector.


### Returns 


The closest matching element; otherwise, `null`.


```python
def closest(self, selector):
    ...
```


| Parameter | Type | Description |
| :- | :- | :- |
| selector | str | The selector. |



### See Also
* module [`aspose.html`](../../)
* class [`Element`](/html/python-net/aspose.html.dom/element)
* class [`HTMLTableSectionElement`](/html/python-net/aspose.html/htmltablesectionelement)
